@import url('../vendor/fonts/fonts.css');

/* 代理后台主题：朱砂宣纸。Tailwind 工具类色板由 js/theme.js 改写，
   此处只做组件层与必要的高特异性覆盖（body 前缀用于压过工具类）。 */

[x-cloak] { display: none !important; }

:root {
    --bg-page: #FFFCF7;
    --bg-card: #FFFCF7;
    --bg-soft: #FAF1E6;
    --bg-input: #FAF1E6;
    --border: #E7D6C3;
    --border-soft: #F0E3D4;
    --text-primary: #2B2118;
    --text-secondary: #4A3D31;
    --accent: #C0392B;
    --accent-light: #FBEAE4;
    --accent-text: #7E2016;
    --violet: #5B4B8A;
    --success: #2E7D5B;
    --success-bg: #E9F4EE;
    --danger: #B4231A;
    --danger-bg: #FBEAE4;
    --warning: #B57B24;
    --warning-bg: #FBF0DC;
    --pill: 999px;
}

body {
    font-family: 'PingFang SC', 'HarmonyOS Sans SC', 'Microsoft YaHei', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    background: var(--bg-page);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
    min-width: 320px;
    overflow-x: hidden;
}

code, .font-mono { font-family: 'Fira Code', ui-monospace, monospace; }

table { font-size: 0.9375rem; }
th { font-size: 0.8125rem; font-weight: 700; color: var(--text-secondary); letter-spacing: 0.04em; }

.app-shell { height: 100vh; }

@supports (height: 100dvh) {
    .app-shell { height: 100dvh; }
    .auth-bg { min-height: 100dvh; }
}

.overflow-x-auto { -webkit-overflow-scrolling: touch; }
.overflow-x-auto > table { min-width: max-content; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- 表单控件 ---------- */
.input-field {
    width: 100%; height: 3rem; padding-left: 2.75rem; padding-right: 1rem;
    background: var(--bg-input); border: 1.5px solid var(--border-soft); border-radius: 14px;
    color: var(--text-primary); font-size: 0.9375rem; outline: none;
    transition: border-color 180ms, box-shadow 180ms, background 180ms;
}
.input-field:focus-visible { background: #FFF; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(192, 57, 43, .1); }
.input-field::placeholder { color: #A99781; }

.input-simple {
    width: 100%; height: 3rem; padding: 0 1rem;
    background: var(--bg-input); border: 1.5px solid var(--border-soft); border-radius: 14px;
    color: var(--text-primary); font-size: 0.9375rem; outline: none;
    transition: border-color 180ms, box-shadow 180ms, background 180ms;
}
.input-simple:focus-visible { background: #FFF; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(192, 57, 43, .1); }
.input-simple::placeholder { color: #A99781; }

.btn-primary {
    width: 100%; height: 3.25rem;
    background: linear-gradient(180deg, #C8412F, #A82C1F); color: #FFF6F0;
    font-weight: 700; letter-spacing: .06em;
    border-radius: var(--pill); border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    box-shadow: 0 10px 22px -12px rgba(168, 44, 31, .95);
    transition: filter 180ms, transform 100ms, box-shadow 180ms;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn-primary:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }

.field-error { margin-top: 0.3rem; padding-left: 0.25rem; color: var(--danger); font-size: 0.8rem; font-weight: 600; }

/* ---------- 去卡片化：分区靠细线与留白，不用卡片与投影 ---------- */
.card {
    background: none; border: 0; border-top: 1px solid var(--border-soft);
    border-radius: 0; box-shadow: none;
}

.stat-card {
    position: relative; overflow: visible;
    padding: 14px 16px 14px 0;
    background: none; border: 0; border-top: 2px solid var(--accent);
    border-radius: 0; box-shadow: none;
}

.badge-success { background: var(--success-bg); color: var(--success); padding: 2px 11px; border-radius: var(--pill); font-size: 0.8125rem; font-weight: 700; }
.badge-warning { background: var(--warning-bg); color: var(--warning); padding: 2px 11px; border-radius: var(--pill); font-size: 0.8125rem; font-weight: 700; }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);  padding: 2px 11px; border-radius: var(--pill); font-size: 0.8125rem; font-weight: 700; }
.badge-info    { background: var(--accent-light); color: var(--accent-text); padding: 2px 11px; border-radius: var(--pill); font-size: 0.8125rem; font-weight: 700; }

/* ---------- 登录 / 注册 / 找回 ---------- */
.auth-bg {
    min-height: 100vh;
    background: var(--bg-page);
    background-image:
        radial-gradient(1100px 520px at 50% -160px, rgba(192, 57, 43, .16), transparent 62%),
        radial-gradient(760px 460px at 6% 104%, rgba(91, 75, 138, .12), transparent 60%);
    background-attachment: fixed;
}

.auth-card {
    padding: 2.25rem;
    background: var(--bg-card); backdrop-filter: none;
    border: 0; border-radius: 22px;
    box-shadow: 0 2px 0 rgba(160, 115, 85, .1), 0 26px 60px -26px rgba(120, 55, 35, .45);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D8C3AC; border-radius: 3px; }

/* ---------- 工具类覆盖（body 前缀提高特异性，压过 Tailwind 生成的规则） ---------- */
body .bg-white { background-color: var(--bg-card); }
body .bg-white\/80, body .bg-white\/90 { background-color: rgba(255, 252, 247, .92); }

/* 内容区去卡片：弹窗在 .app-shell 之外，不受影响 */
.app-shell main .bg-white { background-color: transparent; }
.app-shell main :is(.rounded-xl, .rounded-lg, .rounded-2xl) { border-radius: 3px; }
.app-shell main :is(.shadow-sm, .shadow, .shadow-md, .shadow-lg, .shadow-xl) { box-shadow: none; }
.app-shell main :is(.border, .border-b, .border-t):is(.border-slate-100, .border-slate-200) { border-color: var(--border-soft); }
/* 整框描边 → 单条顶线，避免去掉底色后变成空心盒子 */
.app-shell main .border:not(.border-b):not(.border-t):not(.border-l):not(.border-r) {
    border-width: 1px 0 0; border-color: var(--border-soft);
}
body :is(button, a, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid var(--violet); outline-offset: 3px;
}

/* ---------- 侧边栏：朱砂实底 ---------- */
.app-shell > aside {
    border: 0;
    background: linear-gradient(170deg, #C8412F 0%, #B23124 45%, #93241A 100%);
    color: #FFE7DE;
}
.app-shell > aside > div { height: 72px; border-color: rgba(255, 255, 255, .16); }
.app-shell > aside .text-slate-800 { color: #FFF6F0; font-weight: 700; letter-spacing: .04em; }
.app-shell > aside :is(.bg-indigo-50, .bg-white) { background-color: rgba(255, 255, 255, .16); }
.app-shell > aside .border-indigo-200 { border-color: rgba(255, 255, 255, .28); }
.app-shell > aside .text-indigo-600 { color: #FFF2EC; }
.app-shell > aside nav { padding: 16px 10px; }
.app-shell > aside nav .text-slate-500 { color: rgba(255, 232, 224, .82); }
.app-shell > aside nav .text-indigo-600 { color: #FFF6F0; }
.app-shell > aside nav button:hover { color: #FFF; }
.app-shell > aside nav .border-slate-100 { border-color: rgba(255, 255, 255, .18); }

.app-shell > aside nav { padding: 8px 0; }
.sidebar-item {
    position: relative;
    border-radius: 0; margin-bottom: 0; cursor: pointer;
    transition: background-color 150ms, color 150ms;
}
.sidebar-item:hover { background: rgba(255, 255, 255, .12); }
.sidebar-item.active { background: rgba(255, 255, 255, .2); color: #FFF8F4; box-shadow: none; }
.sidebar-item.active::before {
    content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
    width: 3px; border-radius: 0 3px 3px 0; background: #FFF2EC;
}

/* ---------- 顶栏与主区 ---------- */
.app-shell header {
    height: 72px;
    background: var(--bg-card);
    border-color: var(--border-soft);
    box-shadow: none;
    backdrop-filter: none;
}
.app-shell header h2 { font-size: 18px; font-weight: 800; letter-spacing: .01em; }
.app-shell main { background: var(--bg-page); }

/* ---------- 首页欢迎条：细线分区，不用渐变色块 ---------- */
.workspace-welcome {
    position: relative; overflow: visible;
    padding: 0 0 20px !important;
    border: 0; border-bottom: 1px solid var(--border-soft); border-radius: 0;
    background: none;
    color: var(--text-primary);
}
.workspace-welcome::after { display: none; }
.workspace-welcome h2 { font-size: 22px; font-weight: 800; letter-spacing: .01em; color: var(--text-primary); }
.workspace-welcome :is(.text-indigo-200, .text-indigo-300) { color: var(--text-muted); }
.workspace-welcome .text-white { color: var(--text-primary); }
.workspace-welcome :is(.bg-white\/15, .bg-white\/20) { background-color: var(--accent-light); color: var(--accent-text); }
.workspace-welcome :is(.border-white\/20) { border-color: var(--accent-light); }
.workspace-welcome button { color: var(--accent-text); }

/* ---------- 表格 ---------- */
table th {
    background: none;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 11.5px; font-weight: 700; letter-spacing: .12em;
}
table td { border-color: var(--border-soft); }
.app-shell main table :is(th, td) { padding: 10px 12px; }
.app-shell main table tbody tr:hover { background: var(--bg-soft); }
body .border-slate-100 { border-color: var(--border-soft); }
body .border-slate-200 { border-color: var(--border); }
body .bg-slate-50 { background-color: var(--bg-soft); }

/* ---------- 登录页品牌行 ---------- */
.auth-bg > main { max-width: 440px; }
.auth-bg > main::before {
    content: '幻境西游 · 代理工作台';
    display: block; margin: 0 0 18px;
    color: var(--accent-text); font-size: 13px; font-weight: 700;
    letter-spacing: .22em; text-align: center;
}
.auth-card h1 { font-size: 26px; font-weight: 800; letter-spacing: .01em; }

@media (max-width: 767px) {
    .app-shell header, .app-shell > aside > div { height: 60px; }
    .app-shell header button { min-width: 44px; min-height: 44px; }
    .app-shell > aside nav button { min-height: 44px; }
}

@media (max-width: 640px) {
    body { font-size: 14px; }
    .auth-bg > main::before { font-size: 12px; letter-spacing: .16em; }
    .auth-card { padding: 1.5rem 1.25rem; border-radius: 18px; }
    .input-field, .input-simple { height: 2.75rem; font-size: 1rem; }
    .btn-primary { height: 3rem; }
    .stat-card { padding: 1rem; }
}
