/* =============================================================================
   Agent Meeko Console - Subs (22 Oct 2026)
   Built on the AM Navy pieces the Domains pages use (summary counters, domain
   cards, overview tiles, Kudio fields); only what Subs adds lives here.
   ============================================================================= */

/* ---- Toolbar: search, the period fields, then the buttons ----------------- */
.subs-toolbar {
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.subs-period {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.subs-period .kudio-field-group { margin: 0; min-width: 170px; }
.subs-period .kudio-field-hint,
.subs-period .kudio-field-error { display: none; }

/* ---- Tiles ------------------------------------------------------------------ */
.subs-tiles { margin-bottom: 18px; }

.subs-tile__hint {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-muted);
}

.domain-tiles .subs-tile--figure,
.domain-tiles .subs-tile--figure:hover {
    cursor: default;
    border-color: var(--border-subtle);
    background: var(--surface-panel);
}

/* ---- Table ------------------------------------------------------------------ */
.subs-table th { padding: 0; }

.subs-sort {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    background: none;
    font: inherit;
    font-weight: 600;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.subs-sort:hover,
.subs-sort--on { color: var(--am-blue, #19213b); }
.subs-sort:focus-visible { outline: none; box-shadow: var(--am-focus); border-radius: 4px; }

.subs-table__row { cursor: pointer; }
.subs-table__row:hover td { background: var(--surface-hover, rgba(16, 24, 40, 0.03)); }
.subs-table__row:focus-visible { outline: 2px solid var(--am-blue, #19213b); outline-offset: -2px; }

.subs-table td small,
.subs-linked__text small {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-muted);
}

.subs-ref,
.subs-subdomain {
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
    font-size: 12.5px;
    color: var(--text-secondary, var(--text-primary));
}

.subs-name { font-weight: 600; color: var(--text-primary); }

.subs-tag {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--am-blue, #19213b);
    background: var(--status-info-tint, rgba(25, 33, 59, 0.08));
}

/* ---- Panel ------------------------------------------------------------------ */
.subs-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 8px;
}

/* .domain-card already pads its body; these sit flush with the fields. */
.subs-plan__body { padding: 0; }

.subs-field--wide { grid-column: 1 / -1; }

.subs-linked {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* ---- Overview tiles (AM Navy) ------------------------------------------------ */
.subs-hero {
    padding: 0;
    background: transparent;
}

.subs-hero__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.subs-hero__tile {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    padding: 12px;
    border-radius: 5px;
    background: rgba(25, 33, 59, 0.045);
    border: 1px solid transparent;
    transition: border-color 0.3s ease, background 0.3s ease;
}

.subs-hero__tile:hover {
    border-color: rgba(25, 33, 59, 0.18);
}

.subs-hero__glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 5px;
    background: #ffffff;
    color: var(--am-blue, #19213b);
}

.subs-hero__text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.subs-hero__label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted, #667085);
}

.subs-hero__value {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--am-blue, #19213b);
    overflow-wrap: anywhere;
}

.subs-hero__value small {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted, #667085);
}

.subs-hero__value .status-pill { font-size: 12px; vertical-align: middle; }

.subs-hero__sub {
    font-size: 12px;
    color: var(--text-secondary, #475467);
}

.subs-hero__wait { animation: subs-hero-wait 1.6s ease-in-out infinite; }

@keyframes subs-hero-wait {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 1; }
}

.subs-hero__bar {
    display: block;
    height: 4px;
    margin-top: 4px;
    border-radius: 999px;
    background: rgba(25, 33, 59, 0.12);
    overflow: hidden;
}

.subs-hero__bar > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--am-blue, #19213b);
    transition: width 0.6s ease;
}

@media (prefers-reduced-motion: reduce) {
    .subs-hero__wait { animation: none; }
}

@media (max-width: 960px) {
    .subs-hero__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- Tabs: Overview | Modules ------------------------------------------------ */
.subs-tabs { margin-top: 2px; }

.subs-tabs .record-tab {
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--text-muted, #667085);
    font-weight: 600;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.subs-tabs .record-tab:hover { color: var(--am-blue, #19213b); }

.subs-tabs .record-tab--active {
    color: var(--am-blue, #19213b);
    border-bottom-color: var(--am-blue, #19213b);
    background: transparent;
}

.subs-pane {
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: subs-pane-in 0.35s ease;
}

.subs-pane[hidden] { display: none; }

@keyframes subs-pane-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

/* The agency's Modules cards, inside the panel. */
.mx-embed .mx-group + .mx-group { margin-top: 22px; }
.mx-embed .mx-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.mx-embed__empty,
.mx-embed__note {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted, #667085);
}

.mx-embed__note { margin-top: 16px; }

@media (prefers-reduced-motion: reduce) {
    .subs-pane { animation: none; }
}

/* ---- Small screens ---------------------------------------------------------- */
@media (max-width: 720px) {
    .subs-period { width: 100%; }
    .subs-period .kudio-field-group { flex: 1 1 140px; min-width: 0; }
    .subs-table td:nth-child(4),
    .subs-table th:nth-child(4) { display: none; }
    .subs-linked { flex-direction: column; align-items: flex-start; }
}

/* ---- Delete an agency (shared by Subs and My Account) ------------------------ */
.agency-delete {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.agency-delete__loading { margin: 0; color: var(--text-muted, #667085); }

.agency-delete__tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.agency-delete__tile {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border-radius: 5px;
    background: rgba(25, 33, 59, 0.045);
}

.agency-delete__glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 5px;
    background: #ffffff;
    color: var(--am-blue, #19213b);
}

.agency-delete__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.agency-delete__label { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted, #667085); }
.agency-delete__value { font-size: 15px; font-weight: 700; color: var(--am-blue, #19213b); }
.agency-delete__sub { font-size: 12px; color: var(--text-secondary, #475467); }

.agency-delete__heading {
    margin: 4px 0 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--am-blue, #19213b);
}

.agency-delete__choices { display: flex; flex-direction: column; gap: 10px; }

.agency-delete__choice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--border-default, #e4e7ec);
    border-radius: 5px;
    cursor: pointer;
    transition: border-color 0.3s ease, background 0.3s ease;
}

.agency-delete__choice:hover { border-color: rgba(25, 33, 59, 0.35); }

.agency-delete__choice--on {
    border-color: var(--am-blue, #19213b);
    background: rgba(25, 33, 59, 0.035);
}

.agency-delete__choice input { margin: 3px 0 0; accent-color: var(--am-blue, #19213b); }

.agency-delete__choice-body { display: flex; flex-direction: column; gap: 4px; }

.agency-delete__choice-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    color: var(--am-blue, #19213b);
}

.agency-delete__choice-text { font-size: 13px; color: var(--text-secondary, #475467); line-height: 1.45; }

.agency-delete__error {
    margin: 0;
    padding: 10px 12px;
    border-radius: 5px;
    background: var(--status-danger-tint, #fef3f2);
    color: var(--status-danger, #b42318);
    font-size: 13px;
}

.agency-delete__error[hidden] { display: none; }

/* My Account: the danger card */
.my-account-card--danger { border-color: rgba(180, 35, 24, 0.25); }
.my-account-card--danger .my-account-card__icon { color: var(--status-danger, #b42318); }
.my-account-danger__text { margin: 0 0 14px; color: var(--text-secondary, #475467); line-height: 1.5; }

@media (max-width: 720px) {
    .agency-delete__tiles { grid-template-columns: 1fr; }
}
