/* ==========================================================================
   AI console (admin.espandarco.tech)
   Its own small sheet on top of edic-tokens.css: the console has none of the
   portal's chrome. Quiet by design - no frames, shadows or tints; colour only
   where it means something (up, down, paused).
   ========================================================================== */

html { background: var(--ed-canvas); }

body.aic {
    margin: 0;
    color: var(--ed-text);
    background: var(--ed-canvas);
    font-family: var(--ed-font);
    font-size: var(--ed-text-body);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.aic a { color: var(--ed-accent); text-decoration: none; }
.aic a:hover { text-decoration: underline; }
.aic h1 { font-size: var(--ed-text-display); font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.aic h2 { font-size: var(--ed-text-title); font-weight: 600; margin: var(--ed-space-10) 0 var(--ed-space-3); }
.aic p { margin: 0; }
.aic code { font-family: var(--ed-font-mono); font-size: var(--ed-text-subhead); }

/* --- top bar ------------------------------------------------------------- */

.aic-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--ed-space-2) var(--ed-space-8);
    max-width: 1080px;
    margin: 0 auto;
    padding: var(--ed-space-5) var(--ed-space-4);
    border-bottom: 1px solid var(--ed-separator-soft);
}
.aic-brand { font-weight: 600; color: var(--ed-text) !important; }
.aic-brand span { color: var(--ed-text-secondary); font-weight: 500; }
.aic-nav { display: flex; gap: var(--ed-space-5); flex: 1; }
.aic-nav a { color: var(--ed-text-secondary); }
.aic-nav a[aria-current="page"] { color: var(--ed-text); font-weight: 600; }
.aic-who { display: flex; align-items: center; gap: var(--ed-space-3); color: var(--ed-text-secondary);
           font-size: var(--ed-text-subhead); margin: 0; }

.aic-main { max-width: 1080px; margin: 0 auto; padding: var(--ed-space-8) var(--ed-space-4) var(--ed-space-16); }

/* --- text ---------------------------------------------------------------- */

.aic-muted { color: var(--ed-text-secondary); font-size: var(--ed-text-subhead); }
.aic-note { color: var(--ed-text-tertiary); font-size: var(--ed-text-subhead); margin-top: var(--ed-space-4) !important; }
.aic-label { font-size: var(--ed-text-subhead); font-weight: 600; margin-bottom: var(--ed-space-2) !important; }
.aic-error { color: var(--ed-danger); font-size: var(--ed-text-subhead); margin: var(--ed-space-2) 0 !important; }
.aic-heading { display: grid; gap: var(--ed-space-2); margin-bottom: var(--ed-space-6); }
.aic-back { margin-bottom: var(--ed-space-4) !important; font-size: var(--ed-text-subhead); }
.aic-back a::before { content: "\2190\00a0"; }
.aic-section + .aic-section { margin-top: var(--ed-space-10); }
.aic-nowrap { white-space: nowrap; }

.aic-metric { font-size: var(--ed-text-metric); font-weight: 600; letter-spacing: -0.02em; }
.aic-metric span { font-size: var(--ed-text-body); font-weight: 400; color: var(--ed-text-secondary); }

.aic-messages { margin-bottom: var(--ed-space-6); }
.aic-message { font-size: var(--ed-text-subhead); }
.aic-message--success { color: var(--ed-success); }
.aic-message--error { color: var(--ed-danger); }

/* --- state: dot + word --------------------------------------------------- */

.aic-state { font-size: var(--ed-text-subhead); font-weight: 500; }
.aic-state--up, .aic-state--on { color: var(--ed-success); }
.aic-state--down { color: var(--ed-danger); }
.aic-state--paused { color: var(--ed-warning); }
.aic-state--off { color: var(--ed-text-tertiary); }

.aic-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 0.5rem; flex: none;
           background: var(--ed-text-tertiary); }
.aic-dot--up { background: var(--ed-success); }
.aic-dot--down { background: var(--ed-danger); }

.aic-tag { font-size: var(--ed-text-caption); color: var(--ed-text-tertiary); margin-left: var(--ed-space-2); }

/* --- service list -------------------------------------------------------- */

.aic-status { list-style: none; margin: 0; padding: 0; }
.aic-status__row { display: flex; gap: var(--ed-space-3); padding: var(--ed-space-4) 0;
                   border-bottom: 1px solid var(--ed-separator-soft); }
.aic-status__main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.aic-status__name { font-weight: 600; }
.aic-status__name .aic-state { margin-left: var(--ed-space-2); }
.aic-ms { color: var(--ed-text-tertiary); font-size: var(--ed-text-subhead); font-variant-numeric: tabular-nums;
          white-space: nowrap; }
.aic-facts { display: flex; flex-wrap: wrap; gap: var(--ed-space-1) var(--ed-space-5);
             font-size: var(--ed-text-subhead); color: var(--ed-text-secondary); }
.aic-facts b { color: var(--ed-text); font-weight: 600; }

/* --- tables -------------------------------------------------------------- */

.aic-scroll { overflow-x: auto; }
.aic-table { width: 100%; border-collapse: collapse; font-size: var(--ed-text-subhead); }
.aic-table th, .aic-table td { text-align: left; vertical-align: top; padding: var(--ed-space-3) var(--ed-space-4) var(--ed-space-3) 0;
                               border-bottom: 1px solid var(--ed-separator-soft); }
.aic-table thead th { color: var(--ed-text-secondary); font-weight: 500; }
.aic-table--settings th { font-weight: 400; width: 40%; }
.aic-num { text-align: right !important; font-variant-numeric: tabular-nums; }

.aic-list { list-style: none; margin: 0 0 var(--ed-space-3); padding: 0; font-size: var(--ed-text-subhead); }
.aic-list li { padding: var(--ed-space-2) 0; border-bottom: 1px solid var(--ed-separator-soft); }

.aic-switch { display: flex; gap: var(--ed-space-4); font-size: var(--ed-text-subhead); }
.aic-switch a { color: var(--ed-text-secondary); }
.aic-switch a[aria-current="page"] { color: var(--ed-text); font-weight: 600; }

/* --- forms --------------------------------------------------------------- */

.aic-form { display: grid; gap: var(--ed-space-8); max-width: 720px; }
.aic-group { border: 0; margin: 0; padding: 0; display: grid; gap: var(--ed-space-2); }
.aic-group legend { font-size: var(--ed-text-title); font-weight: 600; padding: 0; margin-bottom: var(--ed-space-2); }
.aic-sub { margin-top: var(--ed-space-4); }
.aic-check { display: flex; align-items: center; gap: var(--ed-space-2); cursor: pointer; }
.aic-check input { accent-color: var(--ed-accent); margin: 0; width: 16px; height: 16px; }
.aic-columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--ed-space-2) var(--ed-space-4); }
.aic-inline { display: flex; flex-wrap: wrap; gap: var(--ed-space-4); }

.aic-field { display: grid; gap: var(--ed-space-1); font-size: var(--ed-text-subhead); }
.aic-field input, .aic-field textarea, .aic-field select {
    font: inherit;
    font-size: var(--ed-text-body);
    color: var(--ed-text);
    background: var(--ed-surface);
    border: 1px solid var(--ed-separator);
    border-radius: var(--ed-radius-sm);
    padding: var(--ed-space-2) var(--ed-space-3);
    width: 100%;
}
.aic-field textarea { font-family: var(--ed-font-mono); font-size: var(--ed-text-subhead); }
.aic-field--short input { width: 9rem; }
.aic-field input:focus-visible, .aic-field textarea:focus-visible, .aic-field select:focus-visible,
.aic-button:focus-visible, .aic-link:focus-visible {
    outline: 3px solid var(--ed-accent-ring);
    outline-offset: 1px;
}

.aic-actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--ed-space-4); }
.aic-button {
    font: inherit;
    font-weight: 600;
    color: var(--ed-text-on-accent);
    background: var(--ed-accent);
    border: 0;
    border-radius: var(--ed-radius-pill);
    padding: var(--ed-space-2) var(--ed-space-6);
    cursor: pointer;
}
.aic-button:hover { background: var(--ed-accent-hover); }
.aic-link { font: inherit; color: var(--ed-accent); background: none; border: 0; padding: 0; cursor: pointer; }
.aic-link:hover { text-decoration: underline; }
.aic-reset { display: flex; flex-wrap: wrap; gap: var(--ed-space-3); align-items: baseline; margin-top: var(--ed-space-8); }

.aic-actions-line { margin-top: var(--ed-space-3) !important; font-size: var(--ed-text-subhead); }
.aic-inline .aic-link { align-self: end; padding-bottom: var(--ed-space-2); }

.aic-inline-form { display: inline; margin: 0 var(--ed-space-3) 0 0; }
.aic-link--danger { color: var(--ed-danger); }
.aic-status__row form { margin: 0; align-self: center; }

.aic-details { font-size: var(--ed-text-subhead); color: var(--ed-text-secondary); }
.aic-details summary { cursor: pointer; color: var(--ed-accent); }
.aic-details pre { white-space: pre-wrap; font-family: var(--ed-font); background: var(--ed-surface-sunken);
                   padding: var(--ed-space-3); border-radius: var(--ed-radius-sm); margin: var(--ed-space-2) 0 0;
                   max-height: 18rem; overflow: auto; }
.aic-field select { appearance: auto; }

/* --- sign-in ------------------------------------------------------------- */

.aic-signin { max-width: 360px; margin: var(--ed-space-12) auto 0; display: grid; gap: var(--ed-space-4); }
.aic-signin form { display: grid; gap: var(--ed-space-4); }
.aic-signin .aic-button { justify-self: start; }

@media (max-width: 640px) {
    .aic-nav { order: 3; flex-basis: 100%; }
    .aic-status__row { flex-wrap: wrap; }
}
