/* Shared file-module styles for /file/* pages */
:root {
  color-scheme: light;
  --bg: #f4efe6;
  --bg-2: #edf4fb;
  --panel: rgba(255,255,255,0.9);
  --panel-solid: #ffffff;
  --text: #1f2937;
  --muted: #667085;
  --line: rgba(31, 41, 55, 0.12);
  --accent: #0f766e;
  --accent-2: #b45309;
  --danger: #b42318;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
  --radius: 20px;
}

html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(15,118,110,0.16), transparent 34%),
    radial-gradient(circle at top right, rgba(180,83,9,0.14), transparent 28%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.28) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.28) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.9), rgba(0,0,0,0.2));
  opacity: 0.45;
}
* { box-sizing: border-box; }
img, picture, figure, video { max-width: 100%; height: auto; display: block; }

a { color: inherit; }

.page { position: relative; z-index: 1; width: calc(100% - 32px); max-width: none; margin: 0 auto; padding: 28px 0 48px; }
.hero { display: grid; grid-template-columns: 1.35fr 0.85fr; gap: 18px; align-items: stretch; margin-bottom: 18px; }
.panel { background: var(--panel); backdrop-filter: blur(16px); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.hero-main { padding: 24px; overflow: hidden; position: relative; }
.hero-main::after { content: ""; position: absolute; right: -20px; top: -20px; width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle, rgba(15,118,110,0.18), transparent 70%); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: rgba(15,118,110,0.1); color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
h1 { margin: 14px 0 10px; font-size: clamp(30px, 5vw, 48px); line-height: 1.05; letter-spacing: -0.03em; }
.lede { margin: 0; max-width: 740px; color: var(--muted); font-size: 15px; line-height: 1.75; }
.hero-aside { padding: 20px; display: grid; gap: 12px; align-content: start; }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.metric { padding: 16px; border-radius: 16px; background: var(--panel-solid); border: 1px solid var(--line); }
.metric .label { color: var(--muted); font-size: 12px; }
.metric .value { margin-top: 6px; font-size: 28px; font-weight: 800; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 18px 0; padding: 16px; }
.search-form { display: flex; gap: 12px; align-items: center; flex: 1 1 420px; min-width: 280px; }
.toolbar input, .toolbar select { border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,0.95); padding: 12px 14px; color: var(--text); min-height: 46px; outline: none; }
.toolbar input { flex: 1 1 260px; }
.toolbar select { flex: 0 0 180px; }
.btn { border: 0; border-radius: 14px; padding: 12px 16px; min-height: 46px; cursor: pointer; font-weight: 700; transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--accent), #155e75); color: #fff; box-shadow: 0 10px 24px rgba(15,118,110,0.24); }
.btn-ghost { background: rgba(255,255,255,0.92); color: var(--text); border: 1px solid var(--line); }
.btn-danger { background: rgba(180,35,24,0.12); color: var(--danger); border: 1px solid rgba(180,35,24,0.22); }
.notice { margin: 18px 0; padding: 16px 18px; border-radius: 16px; background: rgba(255,255,255,0.88); border: 1px solid var(--line); color: var(--muted); line-height: 1.7; }
.notice.error { border-color: rgba(180,35,24,0.25); color: var(--danger); background: rgba(255,245,245,0.92); }
.table-wrap { overflow: auto; border-radius: var(--radius); border: 1px solid var(--line); background: rgba(255,255,255,0.94); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
thead th { position: sticky; top: 0; background: rgba(248,250,252,0.98); text-align: left; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); padding: 14px 12px; white-space: nowrap; }
tbody td { border-bottom: 1px solid rgba(31,41,55,0.08); padding: 12px 10px; vertical-align: top; font-size: 14px; }
tbody tr:hover { background: rgba(15,118,110,0.035); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.wrap { word-break: break-word; }
.desc { max-width: 360px; white-space: pre-wrap; }
.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.public { color: #0f766e; background: rgba(15,118,110,0.12); }
.badge.private { color: #b45309; background: rgba(180,83,9,0.14); }
.preview { display: block; width: 52px; height: 52px; border-radius: 12px; overflow: hidden; background: #f8fafc; border: 1px solid rgba(31,41,55,0.08); flex: none; line-height: 0; }
.preview img, .file-preview-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview.preview-html { display: flex; align-items: center; justify-content: center; padding: 6px; color: var(--accent); background: linear-gradient(135deg, rgba(15,118,110,0.08), rgba(255,255,255,0.98)); font-size: 11px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; text-align: center; }
.file-id-link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.file-id-link:hover { color: #155e75; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.create-panel { margin-top: 18px; padding: 20px; }
.section-title { margin: 0 0 12px; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.section-desc { margin: 0 0 18px; color: var(--muted); line-height: 1.7; }
.create-form { display: grid; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: grid; gap: 8px; }
.field label { font-size: 13px; font-weight: 700; color: var(--text); }
.field input, .field textarea, .field select { border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,0.95); padding: 12px 14px; color: var(--text); min-height: 46px; outline: none; width: 100%; font: inherit; }
.field textarea { min-height: 110px; resize: vertical; }
.upload-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); align-items: start; }
.upload-preview { width: 100%; min-height: 160px; border-radius: 16px; border: 1px dashed rgba(31,41,55,0.18); background: rgba(255,255,255,0.65); display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--muted); }
.upload-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.upload-meta { display: grid; gap: 8px; }
.helper-text { font-size: 13px; color: var(--muted); line-height: 1.6; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.footer { margin-top: 16px; color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.modal-backdrop, .modal-mask { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(15,23,42,0.52); z-index: 20; }
.modal-backdrop.open, .modal-mask.open { display: flex; }
.modal, .modal-dialog { width: min(920px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: rgba(255,255,255,0.98); border-radius: 24px; border: 1px solid rgba(255,255,255,0.6); box-shadow: 0 32px 80px rgba(15,23,42,0.28); }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 20px 0; }
.modal-title { margin: 0; font-size: 22px; font-weight: 800; }
.modal-body { padding: 20px; }
.modal-close { border: 0; background: rgba(15,23,42,0.06); color: var(--text); width: 40px; height: 40px; border-radius: 12px; cursor: pointer; font-size: 20px; line-height: 1; }
.modal-note, .modal-subtitle { margin: 0 0 16px; color: var(--muted); line-height: 1.7; }
.modal-grid { display: grid; gap: 12px; }
.modal-top-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.readonly-note { font-size: 12px; color: var(--muted); margin-top: 4px; }

.cover-uploader { display: grid; gap: 12px; grid-template-columns: minmax(0, 130px) minmax(0, 1fr); align-items: start; }
.cover-preview { width: 100%; min-height: 88px; border-radius: 12px; border: 1px dashed rgba(31,41,55,0.18); background: rgba(255,255,255,0.65); display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--muted); }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-meta { display: grid; gap: 8px; }

body.detail-mode .hero { grid-template-columns: 1fr; }
body.detail-mode .hero-aside,
body.detail-mode .toolbar,
body.detail-mode .table-wrap,
body.detail-mode .create-panel,
body.detail-mode .page > .footer { display: none; }
body.detail-mode .page { padding-bottom: 28px; }
#viewModal.modal-backdrop { position: static; inset: auto; display: none; padding: 0; background: transparent; z-index: auto; align-items: stretch; justify-content: stretch; margin-top: 18px; }
body.detail-mode #viewModal.modal-backdrop { display: block; }
#viewModal .modal { width: 100%; max-height: none; border-radius: 24px; border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; background: var(--panel); backdrop-filter: blur(16px); }
#viewModal .modal-header { padding: 20px 20px 16px; flex: none; position: static; background: transparent; border-bottom: 1px solid rgba(31,41,55,0.08); }
#viewModal .modal-close { width: auto; height: auto; padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 800; background: rgba(15,118,110,0.1); color: var(--accent); }
#viewModal .modal-body { padding: 18px 20px 22px; flex: 1; overflow: visible; }
.view-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr); gap: 16px; height: auto; min-height: 0; align-items: start; }
.view-preview-panel, .view-fields-panel { min-height: 0; overflow: hidden; border-radius: 18px; border: 1px solid rgba(31,41,55,0.08); background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(244,248,255,0.98)); box-shadow: 0 14px 30px rgba(15,23,42,0.08); }
.view-preview-panel { display: flex; flex-direction: column; min-height: 0; }
.view-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid rgba(31,41,55,0.08); flex: none; }
.view-preview-head h3 { margin: 0; font-size: 16px; font-weight: 900; color: var(--text); }
.view-preview-head .kind { color: var(--muted); font-size: 12px; font-weight: 700; }
.view-preview-body { position: relative; flex: none; min-height: 0; height: auto; background: #f8fafc; overflow: visible; }
.view-preview-body img, .view-preview-body iframe { width: 100%; height: auto; display: block; border: 0; background: #fff; }
.view-preview-body img { object-fit: contain; }
.view-preview-empty { position: relative; min-height: 220px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; }
.view-fields-panel { display: flex; flex-direction: column; min-height: 0; max-height: none; overflow: visible; }
.view-fields-head { padding: 16px 18px; border-bottom: 1px solid rgba(31,41,55,0.08); flex: none; }
.view-fields-head h3 { margin: 0 0 4px; font-size: 16px; font-weight: 900; color: var(--text); }
.view-fields-head p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.view-fields-scroll { padding: 16px; overflow: visible; min-height: 0; max-height: none; display: grid; gap: 10px; }
.view-cover { width: 100%; max-width: 420px; margin: 0 auto 18px; border-radius: 18px; overflow: hidden; border: 1px solid rgba(31,41,55,0.10); background: #f8fafc; box-shadow: 0 14px 30px rgba(15,23,42,0.12); }
.view-cover img { width: 100%; height: auto; display: block; object-fit: cover; }
.view-list { display: grid; gap: 10px; }
.view-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px 14px; border-radius: 14px; background: linear-gradient(90deg, rgba(15,118,110,0.04), rgba(255,255,255,0.98)); border: 1px solid rgba(31,41,55,0.08); }
.view-label { color: var(--muted); font-size: 13px; font-weight: 800; letter-spacing: 0.01em; }
.view-value { color: var(--text); font-size: 14px; line-height: 1.8; white-space: pre-wrap; word-break: break-word; }

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .view-layout { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .page { width: min(100% - 20px, 100%); padding-top: 16px; }
  .hero-main, .hero-aside, .toolbar { padding: 16px; }
  .metric-grid { grid-template-columns: 1fr; }
  .search-form { width: 100%; }
  .toolbar input, .toolbar select, .btn { width: 100%; }
  .actions { flex-direction: column; align-items: stretch; }
  .upload-grid, .cover-uploader { grid-template-columns: 1fr; }
  #viewModal .modal-header { padding-left: 16px; padding-right: 16px; }
  #viewModal .modal-body { padding: 12px 16px 16px; }
  .view-preview-panel { min-height: 48vh; }
}

/* ===== File Home ===== */
body.file-home { padding-bottom: 88px; }
body.file-home .page { display: none; }
body.file-home .file-shell { position: relative; z-index: 1; width: min(1440px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 36px; }
body.file-home .file-topbar { display: grid; grid-template-columns: minmax(320px, 1.15fr) minmax(320px, 1.15fr) auto; gap: 18px; align-items: center; padding: 16px 18px; }
body.file-home .file-brand { display: flex; gap: 14px; align-items: center; text-decoration: none; min-width: 0; }
body.file-home .file-brand-logo { width: 98px; height: 98px; padding: 10px; border-radius: 22px; object-fit: contain; background: rgba(255,255,255,0.96); flex: none; box-shadow: 0 12px 28px rgba(15,23,42,0.14); }
body.file-home .file-brand-text { display: grid; gap: 4px; min-width: 0; }
body.file-home .file-brand-text strong { font-size: 20px; letter-spacing: -0.02em; color: var(--text); }
body.file-home .file-brand-text span { color: var(--muted); font-size: 13px; line-height: 1.4; }
body.file-home .file-search { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,0.96); }
body.file-home .file-search-icon { color: var(--muted); font-size: 18px; font-weight: 700; }
body.file-home .file-search input { flex: 1; border: 0; outline: none; min-height: 40px; background: transparent; color: var(--text); font-size: 15px; }
body.file-home .file-userbox { display: flex; align-items: center; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
body.file-home .file-userbox .btn { min-width: 84px; }
body.file-home .file-userchip { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; padding: 10px 14px; border-radius: 999px; background: rgba(255,255,255,0.92); border: 1px solid var(--line); }
body.file-home .file-useravatar { width: 28px; height: 28px; border-radius: 50%; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, rgba(15,118,110,0.18), rgba(180,83,9,0.16)); color: var(--accent); font-size: 13px; font-weight: 800; }
body.file-home .file-useravatar img { width: 100%; height: 100%; object-fit: cover; }
body.file-home .file-layout { display: grid; grid-template-columns: 228px minmax(0, 1fr); gap: 18px; margin-top: 18px; }
body.file-home .file-sidebar { padding: 16px; align-self: start; position: sticky; top: 18px; display: grid; gap: 14px; }
body.file-home .file-nav { display: grid; gap: 8px; }
body.file-home .file-nav-item { display: flex; align-items: center; justify-content: space-between; text-decoration: none; padding: 12px 12px; border-radius: 16px; color: var(--text); background: rgba(255,255,255,0.7); border: 1px solid transparent; transition: all .18s ease; }
body.file-home .file-nav-item::after { content: "›"; color: var(--muted); font-size: 18px; }
body.file-home .file-nav-item:hover,
body.file-home .file-nav-item.active { background: rgba(15,118,110,0.08); border-color: rgba(15,118,110,0.12); color: var(--accent); transform: translateX(2px); }
body.file-home .file-sidebar-card { padding: 14px; border-radius: 16px; background: rgba(255,255,255,0.72); border: 1px solid var(--line); }
body.file-home .file-sidebar-card h2 { margin: 0 0 8px; font-size: 16px; }
body.file-home .file-sidebar-card p { margin: 0; color: var(--muted); line-height: 1.7; font-size: 14px; }
body.file-home .file-admin-links { display: grid; gap: 10px; margin-top: 12px; }
body.file-home .file-main { display: grid; gap: 18px; min-width: 0; }
body.file-home .file-hero { padding: 24px; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr); gap: 18px; align-items: stretch; }
body.file-home .file-hero-copy p { margin: 0; max-width: 760px; color: var(--muted); line-height: 1.8; font-size: 16px; }
body.file-home .file-hero-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
body.file-home .home-stat { padding: 16px; border-radius: 18px; background: rgba(255,255,255,0.92); border: 1px solid var(--line); display: grid; gap: 8px; }
body.file-home .home-stat span { color: var(--muted); font-size: 13px; }
body.file-home .home-stat strong { font-size: 28px; line-height: 1; }
body.file-home .file-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
body.file-home .file-toolbar-left,
body.file-home .file-toolbar-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
body.file-home .file-toolbar-right select { min-width: 140px; }
body.file-home .file-feed { padding: 18px; display: grid; gap: 14px; }
body.file-home .file-feed-head h2 { margin: 0 0 4px; font-size: 20px; }
body.file-home .file-feed-head p { margin: 0; color: var(--muted); }
body.file-home .home-section { display: grid; gap: 14px; }
body.file-home .home-section-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
body.file-home .home-section-grid.is-list { grid-template-columns: 1fr; }
body.file-home .home-section-cards { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }
body.file-home .home-section-cards.is-list .file-card { grid-template-columns: 56px minmax(0, 1fr); }
body.file-home .home-sections-wrap,
body.file-home .home-section-stack { display: grid; gap: 18px; }
body.file-home .home-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
body.file-home .home-section-head h2 { margin: 0; font-size: 18px; }
body.file-home .home-section-head a { color: var(--accent); text-decoration: none; font-weight: 700; }
body.file-home .file-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
body.file-home .file-grid.is-list, body.file-home .file-list { grid-template-columns: 1fr; }
body.file-home .file-card { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; padding: 16px; border-radius: 20px; background: rgba(255,255,255,0.92); border: 1px solid var(--line); box-shadow: 0 12px 28px rgba(15,23,42,0.06); transition: transform .18s ease, box-shadow .18s ease; }
body.file-home .file-card:hover { transform: translateY(-2px); box-shadow: 0 18px 36px rgba(15,23,42,0.1); }
body.file-home .file-card.is-top { background: linear-gradient(180deg, rgba(255,250,236,0.98), rgba(255,255,255,0.96)); border-color: rgba(202,138,4,0.18); }
body.file-home .file-card-icon { width: 64px; height: 64px; border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 28px; background: linear-gradient(135deg, rgba(15,118,110,0.12), rgba(180,83,9,0.12)); flex: none; }
body.file-home .file-card-body { min-width: 0; display: grid; gap: 12px; }
body.file-home .file-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
body.file-home .file-card-head h3 { margin: 0; font-size: 18px; line-height: 1.35; }
body.file-home .file-card-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
body.file-home .file-card-meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
body.file-home .file-card-desc { color: var(--text); line-height: 1.7; font-size: 14px; }
body.file-home .file-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
body.file-home .file-status { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
body.file-home .file-status.public { color: #0f766e; background: rgba(15,118,110,0.12); }
body.file-home .file-status.private { color: #b45309; background: rgba(180,83,9,0.14); }
body.file-home .file-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
body.file-home .file-pagination .btn[disabled] { cursor: not-allowed; opacity: 0.48; transform: none; box-shadow: none; }
body.file-home .file-pagination-status { min-width: 64px; text-align: center; font-size: 14px; font-weight: 800; color: var(--text); }
body.file-home .file-empty { padding: 18px; border-radius: 16px; background: rgba(255,255,255,0.82); border: 1px dashed var(--line); color: var(--muted); }
body.file-home .file-bottom-nav { display: none; }

@media (max-width: 1120px) {
  body.file-home .file-shell { width: min(100% - 20px, 100%); }
  body.file-home .file-topbar { grid-template-columns: 1fr; }
  body.file-home .file-layout { grid-template-columns: 1fr; }
  body.file-home .file-sidebar { position: static; }
}

@media (max-width: 720px) {
  body.file-home { padding-bottom: 112px; }
  body.file-home .file-shell { padding-top: 16px; }
  body.file-home .file-hero { grid-template-columns: 1fr; padding: 18px; }
  body.file-home .file-hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.file-home .home-section-grid { grid-template-columns: 1fr; }
  body.file-home .file-grid { grid-template-columns: 1fr; }
  body.file-home .file-card { grid-template-columns: 52px minmax(0, 1fr); }
  body.file-home .file-card-icon { width: 52px; height: 52px; border-radius: 14px; font-size: 22px; }
  body.file-home .file-pagination { justify-content: space-between; }
  body.file-home .file-pagination .btn { width: auto; flex: 1 1 0; }
  body.file-home .file-brand-logo { width: 74px; height: 74px; padding: 8px; }
  body.file-home .file-search { width: 100%; }
  body.file-home .file-userbox { width: 100%; justify-content: flex-start; }
  body.file-home .file-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    padding: 10px;
    background: rgba(255,255,255,0.94);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
    z-index: 30;
  }
  body.file-home .file-bottom-nav a {
    display: grid;
    place-items: center;
    gap: 4px;
    min-height: 54px;
    text-decoration: none;
    border-radius: 14px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    background: rgba(255,255,255,0.72);
    border: 1px solid transparent;
  }
  body.file-home .file-bottom-nav a.active {
    color: var(--accent);
    border-color: rgba(15,118,110,0.18);
    background: rgba(15,118,110,0.08);
  }
}

/* ===== File Auth ===== */
body.file-auth {
  min-height: 100vh;
  padding: 24px 0 40px;
}
body.file-auth .file-auth-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  gap: 18px;
}
body.file-auth .file-auth-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}
body.file-auth .file-auth-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
body.file-auth .file-auth-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(420px, 520px);
  gap: 18px;
  align-items: stretch;
}
body.file-auth .file-auth-side,
body.file-auth .file-auth-card {
  padding: 28px;
}
body.file-auth .file-auth-side {
  display: grid;
  gap: 18px;
  align-content: start;
  background:
    linear-gradient(160deg, rgba(15,118,110,0.92), rgba(21,94,117,0.88)),
    radial-gradient(circle at top left, rgba(255,255,255,0.22), transparent 34%);
  color: #fff;
  overflow: hidden;
}
body.file-auth .file-auth-side .eyebrow {
  background: rgba(255,255,255,0.14);
  color: #f8fafc;
}
body.file-auth .file-auth-side h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 56px);
  color: #fff;
}
body.file-auth .file-auth-side p {
  margin: 0;
  line-height: 1.8;
  color: rgba(248,250,252,0.88);
}
body.file-auth .file-auth-points {
  display: grid;
  gap: 10px;
}
body.file-auth .file-auth-point {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
}
body.file-auth .file-auth-point strong {
  display: block;
  font-size: 15px;
  margin-bottom: 4px;
}
body.file-auth .file-auth-point span {
  color: rgba(248,250,252,0.84);
  font-size: 13px;
  line-height: 1.7;
}
body.file-auth .file-auth-card {
  display: grid;
  gap: 18px;
  align-content: start;
}
body.file-auth .file-auth-head {
  display: grid;
  gap: 8px;
}
body.file-auth .file-auth-head h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.02em;
}
body.file-auth .file-auth-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}
body.file-auth .file-auth-form {
  display: grid;
  gap: 14px;
}
body.file-auth .file-auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
body.file-auth .file-auth-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
body.file-auth .file-auth-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
body.file-auth .file-auth-links a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}
body.file-auth .file-auth-status {
  min-height: 24px;
  color: var(--muted);
  line-height: 1.7;
}
body.file-auth .file-auth-status.error {
  color: var(--danger);
}
body.file-auth .file-auth-status.success {
  color: var(--accent);
}
body.file-auth .file-auth-footnote {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

@media (max-width: 900px) {
  body.file-auth .file-auth-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body.file-auth {
    padding-top: 16px;
  }
  body.file-auth .file-auth-shell {
    width: min(100% - 20px, 100%);
  }
  body.file-auth .file-auth-topbar,
  body.file-auth .file-auth-side,
  body.file-auth .file-auth-card {
    padding: 18px;
  }
  body.file-auth .file-auth-topbar {
    align-items: flex-start;
    flex-direction: column;
  }
  body.file-auth .file-auth-grid {
    grid-template-columns: 1fr;
  }
  body.file-auth .file-auth-actions {
    flex-direction: column;
    align-items: stretch;
  }
  body.file-auth .file-auth-actions .btn {
    width: 100%;
  }
}

/* ===== File Message ===== */
body.file-message {
  min-height: 100vh;
  padding: 24px 0 40px;
}
body.file-message .file-message-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  gap: 18px;
}
body.file-message .file-message-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}
body.file-message .file-message-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
body.file-message .file-message-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
  gap: 18px;
  align-items: start;
}
body.file-message .file-message-card {
  padding: 22px;
  display: grid;
  gap: 14px;
}
body.file-message .file-message-card h2 {
  margin: 0;
  font-size: 22px;
}
body.file-message .file-message-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}
body.file-message .file-message-list {
  display: grid;
  gap: 12px;
}
body.file-message .file-message-empty {
  padding: 18px;
  border-radius: 16px;
  background: rgba(255,255,255,0.82);
  border: 1px dashed var(--line);
  color: var(--muted);
}
body.file-message .file-message-item {
  border-radius: 18px;
  border: 1px solid rgba(31,41,55,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(244,248,255,0.98));
  box-shadow: 0 12px 28px rgba(15,23,42,0.06);
  padding: 16px;
  display: grid;
  gap: 10px;
}
body.file-message .file-message-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}
body.file-message .file-message-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.45;
}
body.file-message .file-message-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(15,118,110,0.12);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
body.file-message .file-message-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
body.file-message .file-message-content {
  color: var(--text);
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}
body.file-message .file-message-form {
  display: grid;
  gap: 12px;
}
body.file-message .file-message-status {
  min-height: 24px;
  color: var(--muted);
  font-size: 13px;
}
@media (max-width: 900px) {
  body.file-message .file-message-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  body.file-message .file-message-shell {
    width: min(100% - 20px, 100%);
  }
  body.file-message .file-message-topbar {
    align-items: start;
    flex-direction: column;
  }
  body.file-message .file-message-nav {
    width: 100%;
  }
}
