:root {
  --ink: #12213c;
  --muted: #647087;
  --navy: #0b1730;
  --navy-2: #14284c;
  --mint: #43d7b5;
  --mint-dark: #177f70;
  --sky: #2a73e8;
  --danger: #cb3a4a;
  --warning: #b36500;
  --paper: #ffffff;
  --canvas: #f3f6fa;
  --line: #dce3ec;
  --soft: #edf2f7;
  --shadow: 0 20px 60px rgba(21, 38, 68, 0.12);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; margin: 0; }

body {
  min-width: 320px;
  font-size: 16px;
  line-height: 1.5;
  background:
    radial-gradient(circle at 88% 8%, rgba(67, 215, 181, 0.12), transparent 28rem),
    var(--canvas);
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }

:focus-visible {
  outline: 3px solid rgba(42, 115, 232, 0.34);
  outline-offset: 2px;
}

.brand { display: inline-flex; align-items: center; gap: 0.7rem; font-weight: 760; letter-spacing: -0.02em; }
.brand-mark {
  display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 0.65rem;
  color: var(--navy); background: var(--mint); font-size: 1.1rem;
}
.brand.large { font-size: 1.35rem; }
.brand.large .brand-mark { width: 2.7rem; height: 2.7rem; border-radius: 0.85rem; }

.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 15.5rem 1fr; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 1.5rem 1rem; color: #f7fbff;
  background: linear-gradient(170deg, var(--navy), #11264a 78%, #15345c);
  display: flex; flex-direction: column; gap: 2rem;
}
.sidebar .brand { padding: 0 0.65rem; }
.sidebar-nav { display: grid; gap: 0.35rem; }
.nav-link {
  display: flex; align-items: center; gap: 0.8rem; width: 100%; padding: 0.78rem 0.9rem;
  border: 0; border-radius: 0.8rem; color: #bdc9d9; background: transparent; text-decoration: none;
  font-weight: 620; text-align: left;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,0.07); }
.nav-link.active { color: #fff; background: rgba(67, 215, 181, 0.16); box-shadow: inset 3px 0 var(--mint); }
.nav-icon { width: 1.4rem; text-align: center; font-size: 1.05rem; }
.sidebar-foot { margin-top: auto; padding: 0.9rem; color: #9eb0c6; font-size: 0.84rem; }
.quota-mini { height: 0.32rem; border-radius: 99px; background: rgba(255,255,255,0.12); overflow: hidden; margin: 0.6rem 0; }
.quota-mini span { display: block; height: 100%; background: var(--mint); border-radius: inherit; }

.admin-main { min-width: 0; padding: 1.5rem clamp(1rem, 3vw, 3rem) 3rem; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.5rem; margin-bottom: 1.5rem; }
.topbar h1 { margin: 0; font-size: clamp(1.45rem, 2.5vw, 2rem); letter-spacing: -0.035em; }
.account { display: flex; align-items: center; gap: 0.75rem; }
.avatar { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; color: #fff; background: var(--navy); font-weight: 750; }

.surface { background: rgba(255,255,255,0.94); border: 1px solid var(--line); border-radius: 1.15rem; box-shadow: 0 10px 40px rgba(21,38,68,0.055); }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 0.65rem; padding: 1rem; border-bottom: 1px solid var(--line); }
.toolbar-spacer { flex: 1; }
.breadcrumbs { display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; margin: 0 0 0.85rem; color: var(--muted); font-size: 0.9rem; }
.breadcrumbs button { padding: 0.2rem 0.35rem; border: 0; background: transparent; color: inherit; border-radius: 0.4rem; }
.breadcrumbs button:hover { color: var(--sky); background: var(--soft); }

.button {
  display: inline-flex; justify-content: center; align-items: center; gap: 0.45rem; min-height: 2.65rem;
  padding: 0.65rem 1rem; border-radius: 0.75rem; border: 1px solid var(--line); color: var(--ink);
  background: var(--paper); font-weight: 680; text-decoration: none;
}
.button:hover { border-color: #a9b7c9; background: #f9fbfd; }
.button.primary { border-color: var(--navy); color: #fff; background: var(--navy); }
.button.primary:hover { background: var(--navy-2); }
.button.mint { border-color: var(--mint); color: var(--navy); background: var(--mint); }
.button.danger { color: #fff; border-color: var(--danger); background: var(--danger); }
.button.ghost { border-color: transparent; background: transparent; }
.button.small { min-height: 2.15rem; padding: 0.42rem 0.7rem; font-size: 0.88rem; }
.icon-button { width: 2.3rem; height: 2.3rem; border: 0; border-radius: 0.65rem; color: var(--muted); background: transparent; font-size: 1.25rem; }
.icon-button:hover { color: var(--ink); background: var(--soft); }

.search { position: relative; min-width: min(22rem, 100%); }
.search input { width: 100%; min-height: 2.65rem; padding: 0.65rem 0.9rem 0.65rem 2.5rem; border: 1px solid var(--line); border-radius: 0.75rem; background: #f8fafc; }
.search::before { content: "⌕"; position: absolute; left: 0.85rem; top: 0.47rem; color: var(--muted); font-size: 1.25rem; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 0.85rem 1rem; color: var(--muted); background: #f8fafc; font-size: 0.78rem; letter-spacing: 0.05em; text-align: left; text-transform: uppercase; }
.data-table td { padding: 0.9rem 1rem; border-top: 1px solid var(--line); vertical-align: middle; }
.data-table tr:hover td { background: #fbfcfe; }
.name-cell { display: flex; align-items: center; gap: 0.8rem; min-width: 14rem; }
.file-icon { display: grid; place-items: center; flex: 0 0 auto; width: 2.45rem; height: 2.45rem; border-radius: 0.72rem; color: var(--sky); background: #eaf2ff; font-weight: 800; font-size: 0.75rem; }
.file-icon.folder { color: #9a6500; background: #fff2cf; font-size: 1.2rem; }
.name-button { border: 0; padding: 0; color: var(--ink); background: transparent; font-weight: 670; text-align: left; overflow-wrap: anywhere; }
.name-button:hover { color: var(--sky); }
.meta { color: var(--muted); font-size: 0.84rem; }
.row-actions { display: flex; justify-content: flex-end; gap: 0.25rem; }
.pill { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.22rem 0.55rem; border-radius: 99px; color: #186e60; background: #ddf8f1; font-size: 0.78rem; font-weight: 700; }
.pill.neutral { color: var(--muted); background: var(--soft); }
.table-wrap { overflow-x: auto; }

.empty { min-height: 21rem; display: grid; place-items: center; padding: 2rem; text-align: center; }
.empty-inner { max-width: 26rem; }
.empty-icon { display: grid; place-items: center; width: 4.5rem; height: 4.5rem; margin: 0 auto 1rem; border-radius: 1.25rem; color: var(--sky); background: #eaf2ff; font-size: 2rem; }
.empty h2 { margin: 0 0 0.4rem; font-size: 1.15rem; }
.empty p { margin: 0 0 1rem; color: var(--muted); }

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(20rem, 0.85fr) minmax(28rem, 1.15fr); background: var(--navy); }
.login-story { position: relative; overflow: hidden; padding: clamp(2rem, 6vw, 6rem); color: #fff; display: flex; flex-direction: column; justify-content: space-between; }
.login-story::before, .login-story::after { content: ""; position: absolute; border: 1px solid rgba(93,225,193,0.3); border-radius: 50%; }
.login-story::before { width: 30rem; height: 30rem; right: -16rem; top: 8%; }
.login-story::after { width: 18rem; height: 18rem; right: -7rem; top: 27%; background: rgba(93,225,193,0.05); }
.login-story h1 { position: relative; max-width: 8ch; margin: 0; font-size: clamp(2.6rem, 6vw, 5.2rem); line-height: 0.96; letter-spacing: -0.06em; }
.login-story p { position: relative; max-width: 31rem; color: #b8c8da; }
.login-panel { display: grid; place-items: center; padding: 2rem; background: var(--canvas); border-radius: 2rem 0 0 2rem; }
.login-card { width: min(28rem, 100%); }
.login-card .eyebrow { color: var(--mint-dark); }
.login-card h2 { margin: 0.3rem 0 0.5rem; font-size: 2rem; letter-spacing: -0.04em; }
.login-card > p { margin: 0 0 2rem; color: var(--muted); }

.field { display: grid; gap: 0.42rem; margin-bottom: 1rem; }
.field label { font-size: 0.88rem; font-weight: 690; }
.field input, .field textarea, .field select {
  width: 100%; padding: 0.72rem 0.85rem; color: var(--ink); background: #fff;
  border: 1px solid #cbd5e1; border-radius: 0.72rem;
}
.field textarea { min-height: 7rem; resize: vertical; }
.field-hint { color: var(--muted); font-size: 0.82rem; }
.form-error { min-height: 1.5rem; margin: 0.5rem 0; color: var(--danger); font-size: 0.88rem; }

.public-page { min-height: 100vh; }
.public-nav { display: flex; justify-content: space-between; align-items: center; padding: 1.15rem clamp(1rem, 5vw, 5rem); color: #fff; background: var(--navy); }
.public-nav a { text-decoration: none; }
.public-main { width: min(72rem, calc(100% - 2rem)); margin: 0 auto; padding: clamp(2.5rem, 7vw, 6rem) 0; }
.public-heading { display: grid; grid-template-columns: 1fr minmax(18rem, 28rem); gap: 2rem; align-items: end; margin-bottom: 2rem; }
.eyebrow { margin: 0; color: var(--mint-dark); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase; }
.public-heading h1 { margin: 0.35rem 0 0; font-size: clamp(2.1rem, 5vw, 4rem); line-height: 1; letter-spacing: -0.055em; }
.public-heading p { margin: 0.8rem 0 0; color: var(--muted); }
.share-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(20rem, 100%), 1fr)); gap: 1rem; }
.share-card { position: relative; min-height: 13rem; padding: 1.35rem; border: 1px solid var(--line); border-radius: 1rem; background: rgba(255,255,255,0.92); text-decoration: none; transition: transform .18s ease, box-shadow .18s ease; }
.share-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.share-card h2 { margin: 1.2rem 0 0.35rem; font-size: 1.08rem; overflow-wrap: anywhere; }
.share-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.share-card .card-foot { position: absolute; left: 1.35rem; right: 1.35rem; bottom: 1.2rem; display: flex; justify-content: space-between; color: var(--muted); font-size: 0.78rem; }
.detail-card { padding: clamp(1.5rem, 5vw, 3.5rem); }
.detail-card h1 { margin: 1rem 0 0.6rem; font-size: clamp(1.7rem, 5vw, 3rem); letter-spacing: -0.045em; overflow-wrap: anywhere; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 0.7rem 1.5rem; margin: 1.4rem 0 2rem; color: var(--muted); }
.checksum { padding: 0.85rem; border-radius: 0.7rem; color: #47566d; background: var(--soft); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.78rem; overflow-wrap: anywhere; }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1rem; }
.section-head h2 { margin: 0; font-size: 1.25rem; }
.section-head p { margin: 0.2rem 0 0; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat { padding: 1.2rem; }
.stat span { color: var(--muted); font-size: 0.83rem; }
.stat strong { display: block; margin-top: 0.3rem; font-size: 1.5rem; }
.warning-banner { margin-bottom: 1rem; padding: 0.85rem 1rem; border: 1px solid #f4cd80; border-radius: 0.8rem; color: #7b4a00; background: #fff8e6; }

.upload-panel { position: fixed; z-index: 20; right: 1.25rem; bottom: 1.25rem; width: min(24rem, calc(100vw - 2rem)); border: 1px solid var(--line); border-radius: 1rem; background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.upload-panel header { padding: 0.85rem 1rem; color: #fff; background: var(--navy); font-weight: 700; }
.upload-item { padding: 0.8rem 1rem; border-top: 1px solid var(--line); }
.upload-item-top { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.85rem; }
.progress { height: 0.4rem; margin-top: 0.55rem; border-radius: 99px; background: var(--soft); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--mint); transition: width .15s ease; }

.toasts { position: fixed; z-index: 40; top: 1rem; right: 1rem; display: grid; gap: 0.6rem; width: min(24rem, calc(100vw - 2rem)); }
.toast { padding: 0.85rem 1rem; border-radius: 0.8rem; color: #fff; background: var(--navy); box-shadow: var(--shadow); animation: toast-in .2s ease-out; }
.toast.error { background: #9e2634; }
@keyframes toast-in { from { transform: translateY(-0.6rem); opacity: 0; } }

.modal { width: min(34rem, calc(100% - 2rem)); padding: 0; border: 0; border-radius: 1rem; color: var(--ink); box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(6, 16, 34, 0.62); backdrop-filter: blur(2px); }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 1.2rem 1.3rem; border-bottom: 1px solid var(--line); }
.modal h2 { margin: 0.15rem 0 0; font-size: 1.25rem; }
.modal-body { padding: 1.3rem; }
.modal footer { display: flex; justify-content: flex-end; gap: 0.65rem; padding: 1rem 1.3rem; background: #f7f9fb; border-top: 1px solid var(--line); }

.mobile-bar { display: none; }
.loading { min-height: 18rem; display: grid; place-items: center; color: var(--muted); }
.spinner { width: 2rem; height: 2rem; border: 3px solid var(--line); border-top-color: var(--sky); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 820px) {
  .admin-shell { display: block; }
  .sidebar { display: none; }
  .admin-main { padding-bottom: 6rem; }
  .mobile-bar { position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); padding: 0.45rem; color: #c8d2e0; background: var(--navy); }
  .mobile-bar .nav-link { display: grid; justify-items: center; gap: 0.1rem; padding: 0.4rem; font-size: 0.72rem; }
  .public-heading { grid-template-columns: 1fr; align-items: start; }
  .login-page { display: block; background: var(--canvas); }
  .login-story { min-height: 15rem; padding: 1.5rem; }
  .login-story h1 { max-width: none; font-size: 2.7rem; }
  .login-story p { margin-bottom: 0; }
  .login-panel { min-height: calc(100vh - 15rem); border-radius: 1.5rem 1.5rem 0 0; margin-top: -1rem; padding: 2rem 1.25rem; }
  .stats { grid-template-columns: 1fr; }
  .data-table th:nth-child(2), .data-table td:nth-child(2), .data-table th:nth-child(3), .data-table td:nth-child(3) { display: none; }
  .topbar .account span { display: none; }
  .toolbar .search { order: 5; width: 100%; }
}

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