/* 小天ddns服务 — 公共样式 */
:root {
    --primary: #0d6efd;
    --primary-hover: #0b5ed7;
    --bg: #f7f8fa;
    --surface: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --code-bg: #f1f5f9;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

header.site {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
}
header.site .wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
header.site .brand {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}
header.site nav a {
    margin-left: 18px;
    color: var(--muted);
    font-size: 14px;
}
header.site nav a.active { color: var(--primary); font-weight: 600; }

main {
    max-width: 1100px;
    margin: 28px auto;
    padding: 0 20px;
}

h1 { font-size: 24px; margin: 0 0 8px; }
h2 { font-size: 18px; margin: 24px 0 12px; }
.page-title { margin-bottom: 18px; }
.page-subtitle { color: var(--muted); margin-bottom: 20px; font-size: 14px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 18px;
}
.card h3 { margin-top: 0; font-size: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.kv { font-size: 14px; }
.kv .label { color: var(--muted); display: block; font-size: 12px; }
.kv .value { font-size: 22px; font-weight: 600; }

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
table th, table td {
    padding: 10px 14px;
    text-align: left;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
table thead th {
    background: #f9fafb;
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
table tbody tr:nth-child(even) { background: #fafbfc; }
table tbody tr:last-child td { border-bottom: none; }
table .actions a, table .actions button { margin-right: 6px; }
table .muted { color: var(--muted); }
table .tag {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    margin: 1px 2px;
}
table .tag.unreg { background: #fef3c7; color: #92400e; }
table .tag.fail { background: #fee2e2; color: #991b1b; }
table .tag.ok { background: #dcfce7; color: #166534; }

form .form-row { margin-bottom: 14px; }
form label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 500;
}
form input[type=text],
form input[type=password],
form input[type=number],
form textarea,
form select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
}
form textarea { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; min-height: 100px; resize: vertical; }
form input:focus, form textarea:focus, form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.12);
}
form .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
form .checkbox-row { display: flex; align-items: center; gap: 8px; }
form .checkbox-row label { margin: 0; }

.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s;
}
.btn:hover { background: var(--primary-hover); text-decoration: none; color: #fff; }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: #f3f4f6; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b91c1c; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.alert {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert.ok { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert.warn { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert.err { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

footer.site {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    padding: 20px;
    margin-top: 40px;
}

pre, code {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    background: var(--code-bg);
    border-radius: 4px;
}
pre { padding: 12px; overflow-x: auto; font-size: 13px; }
code { padding: 1px 6px; font-size: 13px; }
pre code { padding: 0; background: transparent; }

.help h2 { margin-top: 28px; }
.help table { font-size: 13px; }
.help p { margin: 8px 0; }

.unreg-section h2 { color: var(--warning); }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.section-header h1 { margin: 0; }

@media (max-width: 640px) {
    header.site .wrap { flex-direction: column; align-items: flex-start; }
    header.site nav a { margin-left: 0; margin-right: 14px; }
    main { margin: 16px auto; }
}

/* ========== 补充组件样式（模板中使用但此前缺失的类） ========== */
.alert.error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    white-space: nowrap;
}
.badge.ok    { background: #dcfce7; color: #166534; }
.badge.warn  { background: #fef3c7; color: #92400e; }
.badge.error { background: #fee2e2; color: #991b1b; }
.badge.muted { background: #f3f4f6; color: var(--muted); }

.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; }

/* 表格操作列：统一按钮（a.btn 与 form.inline > button.btn 视觉一致） */
form.inline { display: inline; margin: 0; }
table .actions { white-space: nowrap; }
table .actions a, table .actions button { margin-right: 6px; vertical-align: middle; }
table tr.unregistered td { opacity: 0.6; }
td.domains-cell { max-width: 260px; word-break: break-all; }
td.msg { max-width: 380px; word-break: break-all; font-size: 12px; }

.card.narrow { max-width: 560px; }
.required { color: var(--danger); }

button.link {
    background: none;
    border: none;
    padding: 0;
    color: var(--primary);
    cursor: pointer;
    font-size: inherit;
    text-decoration: underline;
}
button.link.danger { color: var(--danger); }

/* 工具栏按钮组靠右（设备列表顶栏） */
.btn-row.right { margin-left: auto; }

/* 表格单选列 */
th.col-select, td.col-select { width: 36px; text-align: center; padding-right: 4px; }
td.col-select input[type=radio] { cursor: pointer; accent-color: var(--primary); }
