/* ═══════════════════════════════════════════════════════════════
   INDIGO & CLAY · Warm Light Earthy Theme
   Warm | Inviting | Refined | Natural
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.loli.net/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

:root {
    /* ── Warm Light Backgrounds ── */
    --bg-deepest:    #E8E2DA;
    --bg-deep:       #F0EBE4;
    --bg-surface:    #F5F1EC;
    --bg-elevated:   #FBF9F6;
    --bg-card:       #FFFFFF;
    --bg-card-hover: #F8F4EE;
    --bg-sidebar:    #EEE9E2;

    /* ── Indigo (Primary) ── */
    --indigo:        #2A4B7C;
    --indigo-light:  #4A7BBF;
    --indigo-dark:   #1A3055;
    --indigo-soft:   rgba(42, 75, 124, 0.07);
    --indigo-glow:   rgba(42, 75, 124, 0.12);

    /* ── Clay / Terracotta (Accent) ── */
    --clay:          #C2714E;
    --clay-light:    #D9916E;
    --clay-dark:     #A85A3A;
    --clay-soft:     rgba(194, 113, 78, 0.08);
    --clay-glow:     rgba(194, 113, 78, 0.15);

    /* ── Honey Gold (Warm Highlight) ── */
    --honey:         #D4A853;
    --honey-soft:    rgba(212, 168, 83, 0.10);

    /* ── Text ── */
    --text-primary:   #1A1816;
    --text-secondary: #6B6560;
    --text-muted:     #9C958E;
    --text-inverse:   #FBF9F6;

    /* ── Borders ── */
    --border-warm:      1px solid rgba(42, 75, 124, 0.10);
    --border-warm-soft: 1px solid rgba(42, 75, 124, 0.06);
    --border-warm-strong: 1px solid rgba(42, 75, 124, 0.20);
    --border-clay:      1px solid rgba(194, 113, 78, 0.15);
    --border-subtle:    1px solid rgba(0, 0, 0, 0.06);
    --border-light:     1px solid rgba(0, 0, 0, 0.04);

    /* ── Semantic ── */
    --signal:        var(--clay);
    --signal-hover:  var(--clay-light);
    --signal-soft:   var(--clay-soft);
    --signal-glow:   var(--clay-glow);

    --success:       #4A8C5C;
    --success-soft:  rgba(74, 140, 92, 0.10);
    --warning:       #C49B3C;
    --warning-soft:  rgba(196, 155, 60, 0.10);
    --danger:        #C45A4A;
    --danger-soft:   rgba(196, 90, 74, 0.10);

    /* ── Legacy variable mapping ── */
    --vermillion:      var(--clay);
    --vermillion-soft: var(--clay-light);
    --vermillion-glow: var(--clay-glow);
    --ink-deep:        #1A1816;
    --ink-black:       #1A1816;
    --ink-wash:        var(--text-secondary);
    --ink-faded:       var(--text-muted);
    --paper:           var(--bg-surface);
    --paper-warm:      var(--bg-elevated);
    --paper-cream:     var(--bg-card);
    --paper-rose:      var(--bg-card-hover);
    --gold:            var(--honey);
    --gold-muted:      #B8943F;
    --gold-glow:       var(--honey-soft);
    --stone:           var(--text-muted);
    --stone-light:     var(--text-secondary);
    --stone-pale:      rgba(0, 0, 0, 0.05);
    --sage:            var(--success);
    --sage-soft:       var(--success-soft);
    --ochre:           var(--warning);

    /* ── Type ── */
    --font-display: 'DM Serif Display', 'Noto Serif SC', 'STSong', 'SimSun', serif;
    --font-body:    'DM Sans', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', -apple-system, sans-serif;
    --font-mono:    'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --font-cn:      'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;

    /* ── Radii — soft, generous ── */
    --radius-sm:   4px;
    --radius-md:   8px;
    --radius-lg:   12px;
    --radius-xl:   16px;
    --radius-pill: 999px;

    /* ── Shadows — warm, natural ── */
    --shadow-xs: 0 1px 2px rgba(42, 75, 124, 0.04);
    --shadow-sm: 0 2px 8px rgba(42, 75, 124, 0.05);
    --shadow-md: 0 4px 16px rgba(42, 75, 124, 0.06);
    --shadow-lg: 0 8px 32px rgba(42, 75, 124, 0.08);
    --shadow-xl: 0 16px 48px rgba(42, 75, 124, 0.10);
    --shadow-indigo: 0 4px 20px rgba(42, 75, 124, 0.10);
    --shadow-clay: 0 4px 20px rgba(194, 113, 78, 0.10);

    /* ── Transitions ── */
    --ease:       cubic-bezier(0.22, 1, 0.36, 1);
    --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
    --duration:   200ms;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }

html { margin: 0; padding: 0; height: 100%; }

body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-surface);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--indigo); text-decoration: none; transition: color var(--duration) var(--ease); }
a:hover { color: var(--indigo-light); }

/* ── Paper grain texture ── */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10000;
    opacity: 0.02;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
}

body::before { display: none; }

::selection { background: var(--clay); color: var(--text-inverse); }

/* ═══════════════════════════════════════════
   Layout Shell
   ═══════════════════════════════════════════ */

body.material-layout {
    padding: 0;
    display: flex;
    min-height: 100vh;
    background: var(--bg-surface);
}

/* ═══════════════════════════════════════════
   Sidebar — Warm with Indigo Accent
   ═══════════════════════════════════════════ */

.material-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 254px;
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: var(--border-warm);
    box-shadow: 2px 0 24px rgba(42, 75, 124, 0.04);
    z-index: 1000;
    overflow-y: auto;
    transform: translateX(0);
    transition: transform 0.3s var(--ease-out);
    display: flex;
    flex-direction: column;
}

/* Indigo accent stripe */
.material-drawer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg,
        transparent 0%,
        var(--indigo) 15%,
        var(--indigo) 50%,
        var(--indigo-light) 85%,
        transparent 100%
    );
    opacity: 0.4;
}

.material-drawer-content {
    padding: 36px 20px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Decorative rule */
.material-drawer-content::before {
    content: '';
    display: block;
    width: 24px;
    height: 2px;
    background: var(--clay);
    border-radius: 2px;
    margin: 0 auto 28px;
    opacity: 0.5;
}

/* User Card */
.material-user-card {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0 4px 24px;
    margin-bottom: 24px;
    border-bottom: var(--border-warm-soft);
    position: relative;
}

.material-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--indigo), var(--indigo-light));
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    position: relative;
}

.material-avatar::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: var(--bg-elevated);
    border-radius: 50%;
}

.material-user-info { color: var(--text-primary); }

.material-user-label {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.20em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.material-user-email {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 400;
    word-break: break-all;
    color: var(--text-secondary);
}

/* Navigation */
.material-nav { border: none; padding: 0; flex: 1; }

.material-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.material-nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    background: transparent;
    border: 0;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--duration) var(--ease);
    position: relative;
}

.material-nav-item a::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: transparent;
    border: 1.5px solid var(--text-muted);
    flex: 0 0 6px;
    transition: all var(--duration) var(--ease);
}

.material-nav-item a:hover {
    color: var(--indigo);
    background: var(--indigo-soft);
}

.material-nav-item a:hover::before {
    border-color: var(--indigo);
    background: var(--indigo);
}

.material-nav-item.is-active a {
    color: var(--indigo);
    background: var(--indigo-soft);
    font-weight: 600;
}

.material-nav-item.is-active a::before {
    border-color: var(--indigo);
    background: var(--indigo);
    border-width: 2px;
}

.material-nav-item-logout {
    margin-top: auto;
    padding-top: 20px;
    border-top: var(--border-warm-soft);
}

.material-nav-item-logout a { color: var(--text-muted); }

.material-nav-item-logout a:hover {
    color: var(--danger);
    background: var(--danger-soft);
}

.material-nav-item-logout a:hover::before {
    border-color: var(--danger);
    background: var(--danger);
}

/* Mobile toggle */
.brutal-menu-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1100;
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: var(--border-warm-soft);
    border-radius: var(--radius-md);
    cursor: pointer;
    padding: 0;
    box-shadow: var(--shadow-xs);
}

.brutal-menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--indigo);
    margin: 4px auto;
    border-radius: 2px;
}

/* Overlay */
.material-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(42, 75, 124, 0.15);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s var(--ease);
}

.material-drawer-overlay.is-open { display: block; opacity: 1; }

/* ═══════════════════════════════════════════
   Main Content
   ═══════════════════════════════════════════ */

.portal-shell {
    flex: 1;
    margin-left: 254px;
    padding: 48px 56px 80px;
    min-height: 100vh;
    background: var(--bg-surface);
    position: relative;
    z-index: 1;
}

/* Warm top edge */
.portal-shell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--clay) 15%,
        var(--honey) 50%,
        var(--clay) 85%,
        transparent 100%
    );
    opacity: 0.3;
}

.portal-main {
    max-width: 1100px;
    margin: 0 auto;
    animation: clayReveal 0.5s var(--ease-out) both;
}

@keyframes clayReveal {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.portal-panel,
.brutal-main {
    background: var(--bg-elevated);
    border: var(--border-warm-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 40px 44px;
    position: relative;
    overflow: hidden;
}

/* Subtle corner highlight */
.portal-panel::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: linear-gradient(225deg, var(--clay-soft) 0%, transparent 60%);
    pointer-events: none;
}

/* ═══════════════════════════════════════════
   Page Header
   ═══════════════════════════════════════════ */

.page-header {
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: var(--border-warm-soft);
    position: relative;
}

.page-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 48px;
    height: 2px;
    background: var(--clay);
    border-radius: 2px;
    opacity: 0.6;
}

.page-header h1 {
    font-family: var(--font-display);
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 400;
    letter-spacing: -0.01em;
    margin: 0;
    line-height: 1.1;
    color: var(--text-primary);
}

.page-header h1::before {
    content: '— ';
    color: var(--clay);
    font-weight: 400;
    opacity: 0.7;
}

/* ═══════════════════════════════════════════
   Cards
   ═══════════════════════════════════════════ */

.brutal-card,
.box {
    background: var(--bg-card);
    border: var(--border-warm-soft);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    padding: 24px 28px;
    margin-bottom: 16px;
    transition: all var(--duration) var(--ease);
}

.brutal-card:hover {
    border-color: rgba(42, 75, 124, 0.15);
    box-shadow: var(--shadow-indigo);
    background: var(--bg-card-hover);
}

.brutal-card-header {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 400;
    letter-spacing: -0.01em;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: var(--border-warm-soft);
    color: var(--text-primary);
}

.box.box-body { padding: 24px 28px; }

/* ═══════════════════════════════════════════
   Forms
   ═══════════════════════════════════════════ */

.brutal-form { display: flex; flex-direction: column; gap: 20px; }
.brutal-form-group { display: flex; flex-direction: column; gap: 8px; }

.brutal-label {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.brutal-input,
.brutal-select,
.brutal-textarea,
.form-control {
    padding: 12px 16px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 400;
    background: var(--bg-card);
    border: var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: inset 0 1px 3px rgba(42, 75, 124, 0.04);
    transition: all var(--duration) var(--ease);
    color: var(--text-primary);
    height: auto;
    line-height: 1.5;
}

.brutal-input:hover,
.brutal-select:hover,
.brutal-textarea:hover,
.form-control:hover {
    border-color: rgba(42, 75, 124, 0.15);
}

.brutal-input:focus,
.brutal-select:focus,
.brutal-textarea:focus,
.form-control:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px var(--indigo-soft);
    background: var(--bg-card);
}

.brutal-textarea { min-height: 120px; resize: vertical; }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%232A4B7C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
}

/* ═══════════════════════════════════════════
   Buttons — Indigo Primary / Clay Accent
   ═══════════════════════════════════════════ */

.brutal-btn,
.btn {
    padding: 12px 24px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: var(--bg-card);
    border: var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    text-decoration: none;
    display: inline-block;
    color: var(--text-primary);
    position: relative;
    height: auto;
    line-height: 1.4;
}

.brutal-btn:hover,
.btn:hover {
    background: var(--bg-card-hover);
    border-color: rgba(42, 75, 124, 0.15);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.brutal-btn-primary,
.btn-primary {
    background: var(--indigo);
    color: var(--text-inverse);
    border-color: var(--indigo);
}

.brutal-btn-primary:hover,
.btn-primary:hover {
    background: var(--indigo-light);
    color: var(--text-inverse);
    border-color: var(--indigo-light);
    box-shadow: var(--shadow-indigo);
    transform: translateY(-1px);
}

.brutal-btn-danger,
.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: rgba(196, 90, 74, 0.25);
}

.brutal-btn-danger:hover,
.btn-danger:hover {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: var(--danger);
}

.brutal-btn-success {
    background: transparent;
    color: var(--success);
    border-color: rgba(74, 140, 92, 0.25);
}

.brutal-btn-success:hover {
    background: var(--success-soft);
    color: var(--success);
    border-color: var(--success);
}

.brutal-btn-secondary,
.btn-default {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-subtle);
}

.brutal-btn-secondary:hover,
.btn-default:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: rgba(42, 75, 124, 0.12);
}

.btn-flat { border-radius: var(--radius-md); box-shadow: none; }

/* Clay accent button */
.btn-signal,
.brutal-btn-signal {
    background: var(--clay);
    color: var(--text-inverse);
    border-color: var(--clay);
}

.btn-signal:hover,
.brutal-btn-signal:hover {
    background: var(--clay-light);
    color: var(--text-inverse);
    border-color: var(--clay-light);
    box-shadow: var(--shadow-clay);
}

/* ═══════════════════════════════════════════
   Tables
   ═══════════════════════════════════════════ */

.brutal-table-wrapper,
.table-responsive {
    background: var(--bg-card);
    border: var(--border-warm-soft);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.brutal-table,
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

.brutal-table thead,
.table > thead {
    background: var(--bg-deep);
}

.brutal-table th,
.table > thead > tr > th {
    padding: 14px 18px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: left;
    color: var(--indigo);
    border-bottom: var(--border-warm-soft);
    background: var(--bg-deep);
}

.brutal-table td,
.table > tbody > tr > td {
    padding: 16px 18px;
    border-bottom: var(--border-subtle);
    border-top: 0;
    font-weight: 400;
    color: var(--text-primary);
    vertical-align: middle;
    font-size: 14px;
}

.brutal-table tbody tr:last-child td,
.table > tbody > tr:last-child > td { border-bottom: none; }

.brutal-table tbody tr,
.table-hover > tbody > tr {
    transition: background var(--duration) var(--ease);
}

.brutal-table tbody tr:hover,
.table-hover > tbody > tr:hover {
    background: var(--bg-deep);
}

/* ═══════════════════════════════════════════
   Badges & Labels
   ═══════════════════════════════════════════ */

.brutal-badge,
.label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-radius: var(--radius-sm);
    border: var(--border-warm-soft);
    background: var(--bg-deep);
    color: var(--text-secondary);
}

.brutal-badge::before,
.label::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.7;
}

.brutal-badge-success,
.label-success {
    background: var(--success-soft);
    color: var(--success);
    border-color: transparent;
}

.brutal-badge-warning,
.label-warning {
    background: var(--warning-soft);
    color: var(--warning);
    border-color: transparent;
}

.brutal-badge-danger,
.label-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: transparent;
}

/* ═══════════════════════════════════════════
   Nav Tabs
   ═══════════════════════════════════════════ */

.nav-tabs {
    border-bottom: var(--border-warm-soft);
    margin-bottom: 28px;
    display: flex;
    gap: 0;
}

.nav-tabs > li { margin-bottom: -1px; list-style: none; }

.nav-tabs > li > a {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 10px 4px;
    margin-right: 28px;
    transition: all var(--duration) var(--ease);
    background: transparent;
    letter-spacing: 0.04em;
}

.nav-tabs > li > a:hover {
    color: var(--text-primary);
    background: transparent;
    border-color: transparent;
}

.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
    color: var(--indigo);
    font-weight: 600;
    background: transparent;
    border-bottom-color: var(--indigo);
}

.tab-content { padding: 0; }

/* ═══════════════════════════════════════════
   Radio / Checkbox
   ═══════════════════════════════════════════ */

.radio-inline,
.checkbox-inline {
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
}

.radio-inline input,
.checkbox-inline input { accent-color: var(--clay); }

/* ═══════════════════════════════════════════
   Footer — Warm with Clay Line
   ═══════════════════════════════════════════ */

#footer {
    padding: 48px 24px 32px;
    text-align: center;
    border-top: var(--border-warm-soft);
    background: var(--bg-elevated);
    margin-top: 64px;
    position: relative;
}

#footer::before {
    content: '';
    display: block;
    width: 24px;
    height: 2px;
    background: var(--clay);
    border-radius: 2px;
    margin: 0 auto 24px;
    opacity: 0.4;
}

#footer a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--duration) var(--ease);
}

#footer a:hover { color: var(--indigo); }

.portal-footer {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.8;
    font-family: var(--font-mono);
}

.portal-footer .t a { margin: 0 8px; }
.portal-footer .foot-icp { margin-top: 10px; color: var(--text-muted); }

/* ═══════════════════════════════════════════
   Mobile Appbar
   ═══════════════════════════════════════════ */

.material-appbar { display: none; }

@media (max-width: 1024px) {
    .material-appbar {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        align-items: center;
        padding: 0 16px;
        background: var(--bg-elevated);
        border-bottom: var(--border-warm-soft);
        box-shadow: var(--shadow-sm);
        z-index: 998;
        gap: 12px;
    }

    .material-menu-btn {
        width: 38px;
        height: 38px;
        background: var(--bg-card);
        border: var(--border-warm-soft);
        border-radius: var(--radius-md);
        cursor: pointer;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .material-menu-btn:hover { background: var(--bg-card-hover); }
    .material-menu-btn svg { width: 18px; height: 18px; }
    .material-menu-btn path { stroke: var(--indigo); }

    .material-brand { flex: 1; }

    .material-logo {
        font-family: var(--font-display);
        font-size: 18px;
        color: var(--text-primary);
        text-decoration: none;
        letter-spacing: -0.01em;
    }

    .material-user { display: flex; align-items: center; gap: 10px; }
    .material-user span { display: none; }

    .material-user a {
        padding: 6px 14px;
        background: var(--indigo);
        color: var(--text-inverse);
        border: 0;
        border-radius: var(--radius-sm);
        font-family: var(--font-body);
        font-size: 12px;
        font-weight: 600;
        text-decoration: none;
    }

    body.material-layout { padding-top: 56px; }
    .brutal-menu-toggle { display: none; }

    .material-drawer { transform: translateX(-100%); width: 280px; }
    .material-drawer.is-open { transform: translateX(0); }

    .portal-shell { margin-left: 0; padding: 28px 20px 60px; }
    .portal-panel, .brutal-main { padding: 28px 22px; border-radius: var(--radius-md); }
    .page-header h1 { font-size: 28px; }
}

@media (max-width: 640px) {
    .portal-shell { padding: 20px 14px 48px; }
    .portal-panel, .brutal-main { padding: 22px 18px; }
    .page-header h1 { font-size: 24px; }
    .brutal-btn, .btn { padding: 10px 18px; font-size: 13px; }
    .table > thead > tr > th,
    .table > tbody > tr > td { padding: 12px 12px; font-size: 13px; }
}

/* Bootstrap grid */
.row { margin-left: -10px; margin-right: -10px; }
.row > [class*="col-"] { padding-left: 10px; padding-right: 10px; }

/* Special Pages */
.portal-payment { position: relative; }
.portal-legal   { position: relative; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 999px;
    border: 2px solid var(--bg-surface);
    opacity: 0.5;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }
::-webkit-scrollbar-corner { background: var(--bg-surface); }

/* Legal pages */
.portal-legal .content p {
    font-family: var(--font-body);
    line-height: 1.85;
    color: var(--text-secondary);
}

.portal-legal .content p span {
    font-family: var(--font-body) !important;
    color: var(--text-primary) !important;
}

/* ═══════════════════════════════════════════════════════════════
   PAGE COMPONENTS
   ═══════════════════════════════════════════════════════════════ */

/* ── Hero ── */

.portal-hero {
    position: relative;
    margin-bottom: 48px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow: visible;
}

.portal-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.20em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.portal-hero-eyebrow::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--clay);
    border-radius: 50%;
    opacity: 0.7;
}

.portal-hero-eyebrow::after {
    content: '';
    display: inline-block;
    width: 32px;
    height: 1px;
    background: var(--indigo);
    opacity: 0.2;
}

.portal-hero-title {
    margin: 0 0 18px;
    font-family: var(--font-display);
    font-size: clamp(40px, 6vw, 68px);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--text-primary);
    max-width: 18ch;
}

.portal-hero-title em {
    font-style: italic;
    font-weight: 400;
    color: var(--clay);
    font-family: var(--font-display);
}

.portal-hero-sub {
    margin: 0;
    color: var(--text-secondary);
    font-size: 16px;
    max-width: 52ch;
    letter-spacing: 0.01em;
    line-height: 1.6;
}

/* ── Stat Grid ── */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0;
    margin-bottom: 48px;
    border: var(--border-warm-soft);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.stat-card {
    position: relative;
    padding: 28px 28px;
    background: var(--bg-elevated);
    border: 0;
    border-right: var(--border-warm-soft);
    border-radius: 0;
    transition: all var(--duration) var(--ease);
    overflow: hidden;
}

/* Top accent */
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 15%;
    right: 15%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--clay), transparent);
    border-radius: 2px;
    opacity: 0;
    transition: opacity var(--duration) var(--ease);
}

.stat-card:hover::before { opacity: 0.5; }

.stat-card:last-child { border-right: 0; }

.stat-card:hover {
    background: var(--bg-card-hover);
}

.stat-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.15;
}

.stat-value strong { font-weight: 600; }

.stat-card.is-gold .stat-value strong { color: var(--indigo); }

.stat-meta {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.01em;
    font-family: var(--font-body);
}

/* Status dot */
.stat-card::after {
    content: '';
    position: absolute;
    top: 24px;
    right: 24px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.2;
    transition: all var(--duration) var(--ease);
}

.stat-card.is-gold::after { background: var(--clay); opacity: 0.6; }
.stat-card.is-sage::after { background: var(--success); opacity: 0.6; }
.stat-card.is-ink::after  { background: var(--indigo); opacity: 0.4; }

.stat-card:hover::after { transform: scale(1.3); }

@media (max-width: 720px) {
    .stat-card { border-right: 0; border-bottom: var(--border-warm-soft); }
    .stat-card:last-child { border-bottom: 0; }
}

/* ── Quick Action Tiles ── */

.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    background: transparent;
}

.quick-tile {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 28px 26px;
    background: var(--bg-card);
    border: var(--border-warm-soft);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-secondary);
    transition: all var(--duration) var(--ease);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.quick-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--indigo), var(--clay));
    opacity: 0;
    transition: opacity var(--duration) var(--ease);
}

.quick-tile::after {
    content: '→';
    position: absolute;
    right: 22px;
    top: 26px;
    font-size: 18px;
    color: var(--text-muted);
    transition: all var(--duration) var(--ease-out);
    line-height: 1;
}

.quick-tile:hover {
    background: var(--bg-card-hover);
    border-color: rgba(42, 75, 124, 0.15);
    box-shadow: var(--shadow-indigo);
    transform: translateY(-2px);
    color: var(--text-primary);
}

.quick-tile:hover::before { opacity: 1; }

.quick-tile:hover::after {
    color: var(--clay);
    transform: translate(4px, 0);
}

.quick-tile:hover .quick-tile-cn { color: var(--text-primary); }
.quick-tile:hover .quick-tile-en { color: var(--indigo); }

.quick-tile-cn {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 400;
    letter-spacing: -0.01em;
    color: var(--text-secondary);
    margin-top: 4px;
}

.quick-tile-en {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 500;
}

/* ── Profile / Settings Form ── */

.ink-form {
    display: grid;
    /*grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));*/
    gap: 24px 32px;
    margin-top: 8px;
}

.ink-form .ink-field-full { grid-column: 1 / -1; }

.ink-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ink-field-label {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ink-field input[type="text"],
.ink-field input[type="email"],
.ink-field input[type="tel"],
.ink-field input[type="number"],
.ink-field input[type="password"],
.ink-field select,
.ink-field textarea {
    width: 100%;
    padding: 12px 0 12px 0;
    font-family: var(--font-body);
    font-size: 16px;
    background: transparent;
    border: 0;
    border-bottom: 1.5px solid rgba(42, 75, 124, 0.08);
    border-radius: 0;
    color: var(--text-primary);
    box-shadow: none;
    transition: all var(--duration) var(--ease);
}

.ink-field input:focus,
.ink-field select:focus,
.ink-field textarea:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 1.5px 0 0 var(--indigo);
    background: transparent;
}

.ink-field input[disabled] {
    background: transparent;
    color: var(--text-muted);
    cursor: not-allowed;
    border-bottom-style: dashed;
    opacity: 0.5;
}

.ink-radio-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 4px;
}

.ink-radio {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    background: var(--bg-card);
    border: var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all var(--duration) var(--ease);
    font-weight: 500;
}

.ink-radio input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border: 1.5px solid var(--text-muted);
    border-radius: 50%;
    margin: 0;
    position: relative;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.ink-radio input[type="radio"]:checked {
    border-color: var(--clay);
    background: var(--clay);
    box-shadow: inset 0 0 0 3px var(--bg-card);
}

.ink-radio:has(input[type="radio"]:checked) {
    border-color: var(--clay);
    background: var(--clay-soft);
    color: var(--clay-dark);
}

.ink-form-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    margin-top: 16px;
    padding-top: 28px;
    border-top: var(--border-warm-soft);
}

/* ── Payment ── */

.pay-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 0;
    border: var(--border-warm-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-elevated);
    box-shadow: var(--shadow-xs);
}

@media (max-width: 880px) {
    .pay-grid { grid-template-columns: 1fr; }
}

.pay-card {
    position: relative;
    padding: 32px 32px;
    background: var(--bg-elevated);
    border: 0;
    border-radius: 0;
}

.pay-grid > .pay-card:first-child {
    border-right: var(--border-warm-soft);
}

@media (max-width: 880px) {
    .pay-grid > .pay-card:first-child {
        border-right: 0;
        border-bottom: var(--border-warm-soft);
    }
}

.pay-card-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 400;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin: 0 0 22px;
    padding-bottom: 0;
    border-bottom: 0;
    position: relative;
}

.pay-card-title::before {
    content: '— ';
    color: var(--clay);
}

.pay-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: var(--border-subtle);
}

.pay-row:last-child { border-bottom: none; }

.pay-row-label {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.pay-row-value {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.pay-balance {
    margin: 4px 0 28px;
    padding: 28px 0;
    background: transparent;
    border-top: 1.5px solid var(--indigo);
    border-bottom: var(--border-warm-soft);
    border-radius: 0;
    color: var(--text-primary);
    position: relative;
}

.pay-balance-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.20em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.pay-balance-amount {
    font-family: var(--font-display);
    font-size: 52px;
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: -0.04em;
    line-height: 1;
    font-feature-settings: 'tnum';
}

.pay-balance-amount .currency {
    font-size: 22px;
    color: var(--clay);
    margin-right: 6px;
    vertical-align: top;
    line-height: 1.6;
}

.pay-amount-input {
    position: relative;
    margin-top: 4px;
}

.pay-amount-input input {
    width: 100%;
    padding: 14px 16px 14px 36px;
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 400;
    letter-spacing: -0.02em;
    background: var(--bg-card);
    border: var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all var(--duration) var(--ease);
}

.pay-amount-input input:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px var(--indigo-soft);
}

.pay-amount-input::before {
    /*content: '￥';*/
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-body);
    font-size: 20px;
    color: var(--indigo);
    pointer-events: none;
    line-height: 1;
}

.pay-method {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-deep);
    border: 0;
    border-radius: var(--radius-md);
    margin-top: 18px;
}

.pay-method img { height: 24px; width: auto; opacity: 0.7; }

.pay-method-name {
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 600;
}

.pay-qr-card {
    text-align: center;
    padding: 48px 32px;
}

.pay-qr-card img {
    max-width: 220px;
    width: 100%;
    height: auto;
    padding: 16px;
    background: var(--bg-card);
    border: var(--border-warm-soft);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
}

.pay-qr-card .pay-qr-hint {
    margin: 22px 0 0;
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.pay-qr-card .pay-qr-fee {
    margin-top: 8px;
    font-family: var(--font-display);
    font-size: 24px;
    color: var(--indigo);
    letter-spacing: -0.01em;
    font-weight: 400;
}

/* ── Tier Cards ── */

.tier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
    background: transparent;
}

.tier-card {
    position: relative;
    padding: 28px 24px;
    background: var(--bg-card);
    border: var(--border-warm-soft);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    transition: all var(--duration) var(--ease);
    display: block;
    box-shadow: var(--shadow-xs);
}

.tier-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tier-card .tier-duration {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.tier-card .tier-price {
    font-family: var(--font-display);
    font-size: 38px;
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1;
}

.tier-card .tier-price .currency {
    font-size: 18px;
    color: var(--clay);
    margin-right: 4px;
    vertical-align: top;
    line-height: 1.6;
}

.tier-card:hover {
    border-color: rgba(42, 75, 124, 0.15);
    box-shadow: var(--shadow-indigo);
    transform: translateY(-2px);
}

.tier-card:has(input[type="radio"]:checked) {
    border-color: var(--indigo);
    background: var(--indigo-soft);
    box-shadow: var(--shadow-indigo);
}

.tier-card:has(input[type="radio"]:checked) .tier-duration { color: var(--indigo); }
.tier-card:has(input[type="radio"]:checked) .tier-price { color: var(--indigo); }
.tier-card:has(input[type="radio"]:checked) .tier-price .currency { color: var(--indigo-light); }

.tier-card:has(input[type="radio"]:checked)::after {
    content: '';
    position: absolute;
    top: 20px;
    right: 20px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--indigo);
}

/* Seal mark */
.seal-mark {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--indigo);
    background: var(--indigo-soft);
    border-radius: var(--radius-sm);
    border: var(--border-warm-soft);
    font-weight: 600;
}

.seal-mark::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--indigo);
}

/* ═══════════════════════════════════════════
   Page Load Animation
   ═══════════════════════════════════════════ */

@keyframes clayReveal {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════
   Utility Classes
   ═══════════════════════════════════════════ */

.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--danger); font-weight: 500; }
.text-primary { color: var(--text-primary); }
.text-gold { color: var(--honey); }

/* Print */
@media print {
    .material-drawer,
    .material-appbar,
    .brutal-menu-toggle { display: none !important; }
    .portal-shell { margin-left: 0; padding: 0; }
    body::after { display: none !important; }
    .portal-panel, .brutal-main { border: 1px solid #ddd; box-shadow: none; }
}
