:root {
    --brand: #0f5ba8;
    --brand-dark: #0b457f;
    --brand-soft: #eaf3fb;
    --red: #d92d20;
    --red-soft: #fff0ee;
    --green: #16865a;
    --green-soft: #eaf8f1;
    --orange: #c65f00;
    --orange-soft: #fff4e8;
    --ink: #172033;
    --text: #344054;
    --muted: #667085;
    --border: #e3e8ef;
    --surface: #ffffff;
    --canvas: #f4f7fb;
    --shadow: 0 14px 40px rgba(20, 38, 63, .08);
    --radius: 18px;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--canvas);
    font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.topbar {
    min-height: 82px;
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto minmax(260px, 1fr);
    align-items: center;
    gap: 24px;
    padding: 14px 28px;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid #edf0f4;
    box-shadow: 0 1px 0 rgba(16, 24, 40, .02);
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand { display: inline-flex; align-items: center; gap: 14px; width: max-content; }
.brand-logo { width: 72px; height: 52px; object-fit: contain; flex: 0 0 auto; }
.brand-title { color: #111827; font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.brand-subtitle { margin-top: 2px; color: #7c879b; font-size: 12px; }

.main-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px;
    background: #f1f4f8;
    border-radius: 13px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 15px;
    color: #596579;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 650;
    white-space: nowrap;
}

.nav-link:hover { color: var(--brand); background: rgba(255,255,255,.65); }
.nav-link.active { color: var(--brand); background: white; box-shadow: 0 2px 8px rgba(16,24,40,.07); }
.nav-icon { width: 18px; height: 18px; display: grid; place-items: center; font-size: 16px; }

.account-area { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.account-copy { text-align: right; line-height: 1.25; }
.account-name { color: var(--ink); font-size: 13px; font-weight: 700; }
.account-role { color: var(--muted); font-size: 11px; margin-top: 3px; }
.avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: white;
    background: linear-gradient(135deg, var(--brand), #1a8cd8);
    font-weight: 800;
}

.shell { width: min(1540px, calc(100% - 48px)); margin: 0 auto; padding: 30px 0 48px; }

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.eyebrow { color: var(--brand); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 5px 0 6px; color: var(--ink); font-size: clamp(25px, 3vw, 34px); letter-spacing: -.035em; line-height: 1.2; }
.page-description { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.head-actions, .card-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 15px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: #344054;
    background: white;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 1px 2px rgba(16,24,40,.04);
}

.btn:hover { border-color: #cbd5e1; background: #f9fafb; }
.btn:focus-visible, .input:focus, .select:focus { outline: 3px solid rgba(15,91,168,.14); border-color: var(--brand); }
.btn:disabled { cursor: not-allowed; opacity: .58; }
.btn-primary { color: white; border-color: var(--brand); background: var(--brand); box-shadow: 0 5px 14px rgba(15,91,168,.18); }
.btn-primary:hover { color: white; border-color: var(--brand-dark); background: var(--brand-dark); }
.btn-soft { color: var(--brand); border-color: transparent; background: var(--brand-soft); box-shadow: none; }
.btn-soft:hover { border-color: #cae1f4; background: #deedf9; }
.btn-danger { color: var(--red); border-color: transparent; background: var(--red-soft); box-shadow: none; }
.btn-danger:hover { border-color: #ffd3ce; background: #ffe6e3; }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-sm { min-height: 34px; padding: 0 11px; font-size: 12px; }
.icon-btn { width: 40px; padding: 0; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
    min-height: 126px;
    position: relative;
    overflow: hidden;
    padding: 22px 24px;
    border-radius: 17px;
    color: white;
    box-shadow: var(--shadow);
}
.stat::after { content: ""; position: absolute; right: -34px; top: -44px; width: 132px; height: 132px; border-radius: 50%; background: rgba(255,255,255,.12); }
.stat-blue { background: linear-gradient(135deg, #1766bc, #208ee0); }
.stat-green { background: linear-gradient(135deg, #11734e, #25a874); }
.stat-red { background: linear-gradient(135deg, #bd2d24, #ee5d52); }
.stat-orange { background: linear-gradient(135deg, #bd5600, #f08a1c); }
.stat-label { position: relative; z-index: 1; font-size: 13px; opacity: .88; }
.stat-value { position: relative; z-index: 1; margin-top: 13px; font-size: 32px; font-weight: 800; letter-spacing: -.04em; }
.stat-value.time { font-size: clamp(16px, 1.6vw, 22px); letter-spacing: -.02em; margin-top: 19px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(330px, .75fr); gap: 20px; align-items: start; }
.card { background: var(--surface); border: 1px solid rgba(222,228,236,.9); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card + .card { margin-top: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 21px 24px; border-bottom: 1px solid var(--border); }
.card-title { margin: 0; color: var(--ink); font-size: 18px; font-weight: 780; }
.card-subtitle { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.card-body { padding: 22px 24px 25px; }

.status-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin-bottom: 20px; }
.status-box { min-height: 94px; padding: 17px; border: 1px solid var(--border); border-radius: 13px; background: #f9fbfd; }
.status-label { color: var(--muted); font-size: 12px; }
.status-value { margin-top: 8px; color: var(--ink); font-size: 14px; font-weight: 750; line-height: 1.45; word-break: break-word; }
.status-value.good { color: var(--green); }
.status-value.warn { color: var(--orange); }
.status-link { float: right; color: var(--brand); background: none; border: 0; padding: 0; font-size: 12px; font-weight: 700; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.label { color: #475467; font-size: 12px; font-weight: 700; }
.hint { color: var(--muted); font-size: 11px; line-height: 1.5; }
.input, .select {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    color: var(--ink);
    background: white;
    border: 1px solid #d7dee8;
    border-radius: 9px;
    transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: #a5afbf; }
.input:disabled, .select:disabled, .input[readonly] { color: #667085; background: #f5f7fa; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 66px; }
.password-toggle { position: absolute; right: 7px; top: 7px; min-height: 28px; border: 0; border-radius: 7px; color: var(--brand); background: var(--brand-soft); font-size: 11px; font-weight: 700; }

.table-wrap { width: 100%; overflow: auto; border: 1px solid var(--border); border-radius: 13px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
th { height: 44px; padding: 0 14px; color: #475467; background: #f7f9fc; text-align: left; font-size: 12px; font-weight: 750; white-space: nowrap; border-bottom: 1px solid var(--border); }
td { min-height: 58px; padding: 10px 14px; border-bottom: 1px solid #edf0f4; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfcfe; }
.cell-actions { display: flex; justify-content: flex-end; gap: 7px; }
.cell-center { text-align: center; }
.cell-muted { color: var(--muted); }
.empty { padding: 34px 18px; color: var(--muted); text-align: center; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; color: var(--muted); font-size: 12px; }

.switch { position: relative; display: inline-flex; width: 42px; height: 24px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.slider { width: 100%; border-radius: 999px; background: #cbd5df; transition: .2s; }
.slider::after { content: ""; position: absolute; width: 18px; height: 18px; top: 3px; left: 3px; border-radius: 50%; background: white; box-shadow: 0 1px 4px rgba(0,0,0,.2); transition: .2s; }
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::after { transform: translateX(18px); }
.switch input:disabled + .slider { opacity: .55; cursor: not-allowed; }

.badge { display: inline-flex; align-items: center; min-height: 25px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.badge-blue { color: var(--brand); background: var(--brand-soft); }
.badge-green { color: var(--green); background: var(--green-soft); }
.badge-red { color: var(--red); background: var(--red-soft); }
.badge-gray { color: #596579; background: #eef1f5; }
.badge-orange { color: var(--orange); background: var(--orange-soft); }

.notice { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; padding: 14px 16px; color: #285b87; background: #eef6fc; border: 1px solid #d7eaf8; border-radius: 12px; font-size: 12px; line-height: 1.65; }
.notice-icon { flex: 0 0 auto; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 8px; color: white; background: var(--brand); font-weight: 800; }

.abnormal-list { display: grid; gap: 10px; max-height: 580px; overflow: auto; }
.abnormal-item { padding: 14px; border: 1px solid #ffd6d1; border-radius: 12px; background: #fff9f8; }
.abnormal-name { color: var(--ink); font-size: 13px; font-weight: 750; }
.abnormal-url { display: block; margin-top: 6px; color: var(--brand); font-size: 12px; word-break: break-all; }
.abnormal-error { margin-top: 8px; color: var(--red); font-size: 12px; line-height: 1.55; }
.abnormal-time { margin-top: 7px; color: #98a2b3; font-size: 10px; }

.summary-strip { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin-bottom: 20px; }
.summary-card { padding: 18px 20px; border: 1px solid var(--border); border-radius: 15px; background: white; box-shadow: 0 8px 25px rgba(20,38,63,.05); }
.summary-number { color: var(--ink); font-size: 25px; font-weight: 800; }
.summary-label { color: var(--muted); font-size: 12px; margin-top: 4px; }

.user-primary { display: flex; align-items: center; gap: 11px; min-width: 180px; }
.user-dot { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--brand); background: var(--brand-soft); font-weight: 800; }
.user-name { color: var(--ink); font-weight: 750; }
.user-login { color: var(--muted); font-size: 11px; margin-top: 2px; }

.site-table { min-width: 1020px; }
.site-table .col-index { width: 56px; text-align: center; color: var(--muted); }
.site-table .col-name { width: 20%; }
.site-table .col-url { width: 33%; }
.site-table .col-action { width: 84px; text-align: right; }
.input-group { display: flex; align-items: center; gap: 7px; }
.visit-btn { flex: 0 0 auto; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 9px; color: var(--brand); background: white; }

.modal-backdrop { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(18, 28, 45, .58); backdrop-filter: blur(3px); z-index: 100; }
.modal-backdrop.open { display: flex; }
.modal { width: min(620px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: white; border-radius: 18px; box-shadow: 0 25px 80px rgba(0,0,0,.22); }
.modal-sm { width: min(480px, 100%); }
.modal-head, .modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 19px 22px; }
.modal-head { border-bottom: 1px solid var(--border); }
.modal-foot { justify-content: flex-end; border-top: 1px solid var(--border); }
.modal-body { padding: 22px; }
.modal-title { margin: 0; color: var(--ink); font-size: 18px; }
.modal-close { width: 34px; height: 34px; border: 0; border-radius: 9px; color: var(--muted); background: #f1f4f7; font-size: 20px; }

.toast { position: fixed; top: 94px; right: 24px; z-index: 200; min-width: 260px; max-width: 420px; padding: 13px 16px; color: white; background: #182230; border-radius: 11px; box-shadow: 0 14px 35px rgba(0,0,0,.18); font-size: 13px; transform: translateY(-14px); opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #b42318; }

.footer { display: flex; justify-content: space-between; gap: 20px; padding: 26px 2px 0; color: #98a2b3; font-size: 11px; }

.login-page { display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 12% 18%, rgba(15,91,168,.13), transparent 28%), radial-gradient(circle at 88% 84%, rgba(220,42,50,.09), transparent 25%), #f4f7fb; }
.login-shell { width: min(980px, 100%); min-height: 600px; display: grid; grid-template-columns: 1.05fr .95fr; overflow: hidden; border: 1px solid rgba(255,255,255,.72); border-radius: 25px; background: white; box-shadow: 0 30px 90px rgba(18,40,72,.15); }
.login-visual { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 48px; overflow: hidden; color: white; background: linear-gradient(145deg, #0b477e, #0f69ae 58%, #128071); }
.login-visual::before, .login-visual::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.08); }
.login-visual::before { width: 340px; height: 340px; right: -170px; top: -100px; }
.login-visual::after { width: 260px; height: 260px; left: -110px; bottom: -120px; }
.login-brand, .login-message, .login-points { position: relative; z-index: 1; }
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-logo-box { width: 92px; height: 66px; display: grid; place-items: center; border-radius: 15px; background: rgba(255,255,255,.94); }
.login-logo-box img { width: 76px; height: 54px; object-fit: contain; }
.login-brand-title { font-size: 20px; font-weight: 800; }
.login-brand-sub { margin-top: 3px; opacity: .7; font-size: 12px; }
.login-message h1 { color: white; font-size: 38px; margin: 0 0 14px; }
.login-message p { margin: 0; max-width: 390px; opacity: .78; font-size: 14px; line-height: 1.8; }
.login-points { display: flex; gap: 20px; font-size: 11px; opacity: .74; }
.login-panel { display: grid; align-content: center; padding: 58px; }
.login-panel h2 { margin: 0; color: var(--ink); font-size: 27px; letter-spacing: -.03em; }
.login-panel > p { margin: 9px 0 28px; color: var(--muted); font-size: 13px; }
.login-form { display: grid; gap: 17px; }
.login-submit { width: 100%; min-height: 46px; margin-top: 4px; }
.login-security { display: flex; gap: 8px; margin-top: 22px; color: #7b8799; font-size: 11px; line-height: 1.55; }
.login-error { min-height: 18px; margin: 0; color: var(--red); font-size: 12px; }

.readonly-banner { display: none; }
.viewer-mode .readonly-banner { display: flex; }

@media (max-width: 1120px) {
    .topbar { grid-template-columns: 1fr auto; }
    .main-nav { grid-row: 2; grid-column: 1 / -1; justify-self: center; }
    .grid-2 { grid-template-columns: 1fr; }
    .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 760px) {
    .topbar { position: static; grid-template-columns: 1fr; gap: 12px; padding: 14px 18px; }
    .brand { justify-self: center; }
    .account-area { position: absolute; top: 16px; right: 14px; }
    .account-copy { display: none; }
    .main-nav { grid-row: auto; grid-column: auto; width: 100%; overflow-x: auto; justify-content: flex-start; }
    .nav-link { flex: 1 0 auto; justify-content: center; }
    .shell { width: min(100% - 28px, 1540px); padding-top: 22px; }
    .page-head { flex-direction: column; }
    .head-actions { justify-content: flex-start; }
    .stats, .summary-strip, .status-grid, .form-grid { grid-template-columns: 1fr; }
    .field.full { grid-column: auto; }
    .card-head { align-items: flex-start; flex-direction: column; }
    .card-actions { justify-content: flex-start; }
    .login-shell { min-height: auto; grid-template-columns: 1fr; }
    .login-visual { min-height: 245px; padding: 30px; }
    .login-message h1 { font-size: 28px; }
    .login-points { display: none; }
    .login-panel { padding: 36px 30px 42px; }
    .footer { flex-direction: column; }
}

@media (max-width: 480px) {
    .brand-logo { width: 58px; height: 43px; }
    .brand-title { font-size: 17px; }
    .brand-subtitle { display: none; }
    .account-area { top: 13px; }
    .avatar { width: 34px; height: 34px; }
    .nav-link { padding: 0 10px; font-size: 12px; }
    .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat { min-height: 106px; padding: 17px; }
    .stat-value { font-size: 26px; }
    .stat-value.time { font-size: 13px; }
    .card-head, .card-body { padding-left: 17px; padding-right: 17px; }
    .modal-body { padding: 18px; }
}
