/* SMTP Mailer admin UI */
:root {
    --bg:          #f3f4f6;
    --surface:     #ffffff;
    --surface-2:   #f9fafb;
    --border:      #e3e6ea;
    --border-2:    #d4d9df;
    --text:        #171b22;
    --muted:       #68707d;
    --accent:      #2f5bea;
    --accent-dark: #2447c4;
    --accent-soft: #eaf0ff;
    --ok:          #12855a;
    --ok-soft:     #e4f6ee;
    --warn:        #9a6200;
    --warn-soft:   #fdf3dd;
    --bad:         #c02626;
    --bad-soft:    #fdeaea;
    --info:        #1d6fa5;
    --info-soft:   #e6f2fa;
    --radius:      10px;
    --shadow:      0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
    --mono:        ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg:#14161a; --surface:#1c1f25; --surface-2:#22262d; --border:#2c313a; --border-2:#3a4150;
        --text:#e7eaef; --muted:#9aa3b2; --accent:#6c8dff; --accent-dark:#587bf5; --accent-soft:#232b42;
        --ok:#4ec08c; --ok-soft:#18312a; --warn:#e0ad53; --warn-soft:#332a18; --bad:#f08a8a; --bad-soft:#3a2020;
        --info:#6fb6e0; --info-soft:#172c38;
        --shadow: 0 1px 2px rgba(0,0,0,.4);
    }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 1em; }
code, pre { font-family: var(--mono); font-size: 12.5px; }

/* ----------------------------------------------------------------- shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 232px; flex: 0 0 232px; background: var(--surface);
    border-right: 1px solid var(--border); display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; font-weight: 700; font-size: 15px; }
.brand-mark {
    width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff;
    display: grid; place-items: center; font-size: 15px; flex: 0 0 28px;
}
.brand-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
    color: var(--muted); font-weight: 550; font-size: 14px;
}
.nav-item svg { width: 17px; height: 17px; fill: currentColor; opacity: .85; flex: 0 0 17px; }
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.who { display: flex; flex-direction: column; font-size: 12px; line-height: 1.3; overflow: hidden; }
.who span { color: var(--muted); }
.main { flex: 1; min-width: 0; padding: 26px 30px 60px; max-width: 1180px; }
.menu-toggle { display: none; }
.foot { margin-top: 42px; color: var(--muted); font-size: 12px; }

/* ---------------------------------------------------------------- header */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 13.5px; margin: 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ----------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 18px; }
.card-body > :last-child { margin-bottom: 0; }
.card-foot { padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hint { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }

/* ----------------------------------------------------------------- stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat .value { font-size: 26px; font-weight: 680; letter-spacing: -.02em; margin-top: 4px; }
.stat .note { color: var(--muted); font-size: 12px; }

/* ----------------------------------------------------------------- forms */
.field { margin-bottom: 15px; }
.field > label, .field-label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 16px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], select, textarea {
    width: 100%; padding: 9px 11px; border: 1px solid var(--border-2); border-radius: 8px;
    background: var(--surface); color: var(--text); font: inherit; font-size: 14px;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
textarea.code { font-family: var(--mono); font-size: 12.5px; min-height: 260px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input[disabled], textarea[disabled] { background: var(--surface-2); color: var(--muted); }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; margin-bottom: 8px; }
.check input { margin: 3px 0 0; flex: 0 0 auto; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin: 0 0 15px; }
legend { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 0 4px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { margin: 0; }

/* --------------------------------------------------------------- buttons */
.btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 8px;
    border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
    font: inherit; font-size: 14px; font-weight: 580; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-danger { color: var(--bad); border-color: var(--border-2); }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 5px 9px; font-size: 12.5px; border-radius: 7px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data thead th {
    font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
    font-weight: 650; background: var(--surface-2); white-space: nowrap;
}
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.actions { text-align: right; white-space: nowrap; }
.t-main { font-weight: 600; }
.t-sub { color: var(--muted); font-size: 12.5px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ---------------------------------------------------------------- badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 650; letter-spacing: .01em; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* ---------------------------------------------------------------- alerts */
.alert { padding: 11px 14px; border-radius: 9px; margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; }
.alert a { font-weight: 600; }
.alert-success { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 28%, transparent); }
.alert-error { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 28%, transparent); }
.alert-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 28%, transparent); }
.alert-info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 28%, transparent); }

/* ----------------------------------------------------------------- login */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 10px 30px rgba(16,24,40,.08); padding: 28px; }
.login-card .brand { padding: 0 0 18px; font-size: 17px; }

/* -------------------------------------------------------------- progress */
.progress { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.progress > span { display: block; height: 100%; background: var(--accent); transition: width .3s ease; width: 0; }
.log {
    font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 8px; padding: 10px 12px; max-height: 280px; overflow-y: auto; white-space: pre-wrap; word-break: break-word;
}
.log .l-ok { color: var(--ok); }
.log .l-bad { color: var(--bad); }

/* ---------------------------------------------------------------- editor */
.editor { border: 1px solid var(--border-2); border-radius: 8px; overflow: hidden; background: var(--surface); }
.editor-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.editor-bar button {
    border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px;
    padding: 5px 8px; border-radius: 6px; cursor: pointer; min-width: 30px;
}
.editor-bar button:hover { background: var(--border); }
.editor-bar button.on { background: var(--accent-soft); color: var(--accent); }
.editor-bar .sep { width: 1px; background: var(--border); margin: 3px 4px; }
.editor-area {
    min-height: 320px; max-height: 60vh; overflow-y: auto; padding: 14px 16px; outline: none;
    background: #fff; color: #1f2328; font-size: 15px; line-height: 1.6;
}
.editor-area:empty::before { content: attr(data-placeholder); color: #9aa3b2; }
.editor-area img { max-width: 100%; height: auto; }
.editor textarea { border: 0; border-radius: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag-chip {
    font-family: var(--mono); font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 6px; padding: 3px 7px; cursor: pointer; color: var(--muted);
}
.tag-chip:hover { border-color: var(--accent); color: var(--accent); }

/* ---------------------------------------------------------------- misc */
.split { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 18px; align-items: start; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 9px 13px; font-weight: 580; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.kv { width: 100%; font-size: 13.5px; }
.kv td { padding: 5px 0; vertical-align: top; }
.kv td:first-child { color: var(--muted); width: 42%; padding-right: 10px; }
.mono { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar input[type=text], .toolbar select { width: auto; min-width: 150px; }
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 12px 18px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
iframe.preview { width: 100%; height: 70vh; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt { margin-top: 16px; }
.mb0 { margin-bottom: 0; }

@media (max-width: 860px) {
    .split { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; z-index: 40; left: 0; top: 0; transform: translateX(-100%);
        transition: transform .2s ease; box-shadow: 0 0 30px rgba(0,0,0,.2);
    }
    body.nav-open .sidebar { transform: none; }
    .main { padding: 16px 16px 50px; }
    .menu-toggle {
        display: inline-flex; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--border-2);
        border-radius: 8px; width: 38px; height: 38px; align-items: center; justify-content: center;
        font-size: 18px; color: var(--text); cursor: pointer;
    }
}
