/* ==========================================================================
   阿里云短信测试控制台 - 样式
   ========================================================================== */

:root {
    --bg: #f4f5f7;
    --card: #ffffff;
    --border: #e4e6eb;
    --border-strong: #d3d6dc;
    --text: #1f2329;
    --text-mid: #4b5563;
    --muted: #8a919e;
    --primary: #ff6a00;
    --primary-dark: #e35f00;
    --primary-soft: #fff4ec;
    --success: #17a34a;
    --success-soft: #eaf8ef;
    --danger: #dc2626;
    --danger-soft: #fdecec;
    --warn: #d97706;
    --warn-soft: #fdf4e3;
    --info: #2563eb;
    --info-soft: #eaf1fe;
    --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .05);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; }

code {
    font-family: var(--mono);
    font-size: 12.5px;
    background: #f2f3f5;
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 1px 5px;
    word-break: break-all;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 顶栏 ---------- */
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 30;
}
.topbar-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-dot {
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, #ff8a3d, #ff6a00);
    box-shadow: 0 4px 12px rgba(255, 106, 0, .35);
    flex: none;
}
.brand h1 { font-size: 17px; letter-spacing: .2px; }
.brand p { margin: 0; font-size: 12.5px; color: var(--muted); }

.env { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 999px;
    background: #f2f3f5;
    color: var(--text-mid);
    border: 1px solid var(--border);
}
.chip-ok { background: var(--success-soft); color: #15803d; border-color: #c9ecd6; }
.chip-bad { background: var(--danger-soft); color: #b91c1c; border-color: #f6cccc; }

/* ---------- 页签 ---------- */
.tabs {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 63px;
    z-index: 20;
}
.tabs-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    gap: 4px;
    overflow-x: auto;
}
.tab {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-mid);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    font-family: inherit;
    transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ---------- 布局 ---------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 22px 24px 60px; }
.panel.hidden { display: none; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-tight { gap: 12px; }
@media (max-width: 900px) {
    .grid-2 { grid-template-columns: 1fr; }
    .wrap { padding: 16px 14px 50px; }
    .topbar-inner, .tabs-inner { padding-left: 14px; padding-right: 14px; }
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    margin-bottom: 16px;
}
.card > h2 {
    font-size: 15px;
    margin-bottom: 14px;
    padding-left: 10px;
    border-left: 3px solid var(--primary);
    line-height: 1.2;
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.card-head > h2 { margin-bottom: 0; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field > label {
    display: block;
    font-size: 13px;
    color: var(--text-mid);
    margin-bottom: 6px;
    font-weight: 500;
}
.req { color: var(--danger); }

input[type="text"], input[type="password"], input[type="number"], select, textarea {
    width: 100%;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 9px 11px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; font-family: var(--mono); font-size: 13px; line-height: 1.6; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 106, 0, .12);
}
input::placeholder, textarea::placeholder { color: #b8bdc7; }

.input-with-btn { display: flex; gap: 8px; }
.input-with-btn input { flex: 1; }

.hint { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.6; }
.hint.ok { color: var(--success); }
.hint.bad { color: var(--danger); }

.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-mid); cursor: pointer; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--primary); }
.checkbox-inline { white-space: nowrap; }

.form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.form-row .field { flex: 1 1 180px; margin-bottom: 0; }
.form-row .field-sm { flex: 0 0 140px; }
.form-row .field-xs { flex: 0 0 100px; }
.form-row .field-btn { flex: 0 0 auto; }

.row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- 按钮 ---------- */
.btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 13.5px;
    font-family: inherit;
    cursor: pointer;
    background: #f2f3f5;
    color: var(--text);
    transition: background .15s, border-color .15s, color .15s, opacity .15s;
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; border-color: var(--border-strong); color: var(--text-mid); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { padding: 11px 26px; font-size: 15px; font-weight: 600; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.danger-text { color: var(--danger); }
.btn-ghost.danger-text:hover { border-color: var(--danger); color: var(--danger); }

.actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 4px 0 16px;
}

.input-sm {
    padding: 6px 10px;
    font-size: 12.5px;
    border-radius: 7px;
    width: auto;
    min-width: 130px;
}

/* ---------- 结果面板 ---------- */
.result {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.result-head {
    padding: 13px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
    font-weight: 600;
    font-size: 14px;
}
.result-body { padding: 16px 20px; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    padding: 2px 9px;
    border-radius: 999px;
    font-weight: 500;
}
.badge-ok { background: var(--success-soft); color: #15803d; }
.badge-bad { background: var(--danger-soft); color: #b91c1c; }
.badge-warn { background: var(--warn-soft); color: #b45309; }
.badge-info { background: var(--info-soft); color: #1d4ed8; }
.badge-gray { background: #f2f3f5; color: var(--text-mid); }

.kv-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px 20px; }
.kv-list > div { display: flex; gap: 8px; font-size: 13px; align-items: baseline; }
.kv-list .k { color: var(--muted); flex: none; min-width: 84px; }
.kv-list .v { color: var(--text); word-break: break-all; font-family: var(--mono); font-size: 12.5px; }

pre.raw {
    background: #1f2329;
    color: #d7dae0;
    border-radius: 10px;
    padding: 14px 16px;
    overflow: auto;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.65;
    margin: 12px 0 0;
    max-height: 380px;
}
pre.raw.light { background: #f7f8fa; color: #2b3038; border: 1px solid var(--border); }

.err-msg {
    background: var(--danger-soft);
    border: 1px solid #f6cccc;
    color: #b91c1c;
    border-radius: 9px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 12px;
}
.note-msg {
    background: var(--warn-soft);
    border: 1px solid #f5dfb0;
    color: #92400e;
    border-radius: 9px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 12px;
}
.notice {
    background: var(--primary-soft);
    border: 1px solid #ffd9bd;
    color: #9a3412;
    border-radius: 9px;
    padding: 11px 14px;
    font-size: 12.5px;
    line-height: 1.75;
    margin-top: 12px;
}
.notice code { background: #fff; }

.url-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f7f8fa;
    border: 1px dashed var(--border-strong);
    border-radius: 10px;
    padding: 11px 14px;
    flex-wrap: wrap;
}
.url-box code { background: #fff; color: var(--primary); font-size: 13px; flex: 1 1 320px; border-color: var(--border); }

/* ---------- 统计 ---------- */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.stat {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 18px;
}
.stat b { display: block; font-size: 24px; font-weight: 600; line-height: 1.3; color: var(--text); }
.stat b.c-ok { color: var(--success); }
.stat b.c-bad { color: var(--danger); }
.stat b.c-primary { color: var(--primary); }
.stat span { font-size: 12px; color: var(--muted); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.table th, table.table td {
    padding: 9px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    white-space: nowrap;
}
table.table th { background: #fafbfc; color: var(--text-mid); font-weight: 600; font-size: 12.5px; }
table.table tr:last-child td { border-bottom: 0; }
table.table tbody tr:hover { background: #fcfcfd; }
table.table td.wrap-cell { white-space: normal; min-width: 220px; }

/* ---------- 记录列表 ---------- */
.rec-list { display: flex; flex-direction: column; gap: 10px; }

.rec {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    transition: border-color .15s;
}
.rec:hover { border-color: var(--border-strong); }
.rec-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    cursor: pointer;
    flex-wrap: wrap;
}
.rec-head:hover { background: #fafbfc; }
.rec-time { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.rec-summary { flex: 1 1 240px; font-size: 13px; min-width: 0; word-break: break-all; }
.rec-toggle { font-size: 12px; color: var(--muted); }
.rec-body { display: none; padding: 0 14px 14px; border-top: 1px dashed var(--border); }
.rec.open .rec-body { display: block; }
.rec-body pre.raw { margin-top: 12px; max-height: 260px; }
.rec-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 16px; margin-top: 12px; }
.rec-fields > div { font-size: 12.5px; display: flex; gap: 8px; }
.rec-fields .k { color: var(--muted); flex: none; min-width: 96px; font-family: var(--mono); }
.rec-fields .v { word-break: break-all; font-family: var(--mono); }

.empty {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    padding: 34px 10px;
    background: #fafbfc;
    border: 1px dashed var(--border-strong);
    border-radius: 10px;
}

/* ---------- 文档区 ---------- */
ol.doc, ul.doc { margin: 0; padding-left: 22px; color: var(--text-mid); font-size: 13.5px; }
ol.doc li, ul.doc li { margin-bottom: 8px; line-height: 1.8; }
.kv { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.kv > div { font-size: 13px; color: var(--text-mid); }
.kv span { color: var(--muted); }

/* ---------- Toast ---------- */
.toast-wrap {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    background: #1f2329;
    color: #fff;
    padding: 10px 16px;
    border-radius: 9px;
    font-size: 13px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .22);
    animation: toastIn .18s ease-out;
    max-width: 380px;
    word-break: break-all;
}
.toast.ok { background: #15803d; }
.toast.bad { background: #b91c1c; }
.toast.warn { background: #b45309; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- 加载态 ---------- */
.spinner {
    width: 13px; height: 13px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    display: inline-block;
    animation: spin .7s linear infinite;
}
.btn-ghost .spinner { border-color: rgba(0, 0, 0, .18); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

.footer {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    padding: 0 20px 34px;
}
