/* MediaServer Console — "manifest" look: porcelain ground, ink text, cobalt action,
   amber = public signal. Space Grotesk for structure, IBM Plex Mono for data. */

:root {
  --ground: #EDF0F2;
  --surface: #FFFFFF;
  --ink: #17222C;
  --ink-soft: #5A6873;
  --line: #D6DDE2;
  --cobalt: #2450D8;
  --cobalt-deep: #1B3EA8;
  --amber: #C67F00;
  --amber-wash: #FFF4DE;
  --danger: #B3261E;
  --radius: 10px;
  --font-ui: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-ui); background: var(--ground); color: var(--ink); font-size: 15px; }
.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }
.spacer { flex: 1; }

/* ---------- wordmark ---------- */
.wordmark { font-weight: 700; font-size: 26px; letter-spacing: -0.02em; }
.wordmark span { color: var(--cobalt); }
.wordmark.small { font-size: 19px; padding: 20px 18px 8px; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 40px 36px; width: min(400px, 92vw); box-shadow: 0 20px 50px rgba(23,34,44,.08); }
.login-sub { color: var(--ink-soft); margin: 4px 0 28px; }
.login-error { color: var(--danger); font-size: 13px; margin-top: 12px; }

/* ---------- inputs & buttons ---------- */
.field-label { display: block; font-size: 12.5px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-soft); margin: 14px 0 6px; }
.field-label .hint { text-transform: none; font-weight: 400; letter-spacing: 0; }
.text-input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; background: var(--surface); color: var(--ink); font-family: inherit; }
.text-input:focus { outline: 2px solid var(--cobalt); outline-offset: 1px; border-color: var(--cobalt); }
.text-input.compact { width: auto; padding: 7px 10px; }
.check-label { display: flex; gap: 8px; align-items: center; margin: 16px 0 4px; font-size: 14px; }

.btn { font-family: var(--font-ui); font-weight: 600; font-size: 14px; border-radius: 8px;
  padding: 9px 16px; cursor: pointer; border: 1px solid transparent; transition: background .12s; }
.btn:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; }
.btn-primary { background: var(--cobalt); color: #fff; }
.btn-primary:hover { background: var(--cobalt-deep); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: #F2F5F7; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: #FBEDEC; }
.btn-block { width: 100%; margin-top: 20px; }
.icon-btn { border: none; background: transparent; font-size: 18px; cursor: pointer;
  color: var(--ink-soft); line-height: 1; padding: 4px 8px; border-radius: 6px; }
.icon-btn:hover { background: #E4E9ED; color: var(--ink); }

/* ---------- console frame ---------- */
.console { display: grid; grid-template-columns: 232px 1fr auto; min-height: 100vh; }
.rail { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.rail-section { flex: 1; padding: 12px 10px; overflow-y: auto; }
.rail-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; }
.rail-title { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.bucket-list { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.bucket-item { text-align: left; border: none; background: transparent; padding: 8px 10px; border-radius: 7px;
  cursor: pointer; font-family: var(--font-mono); font-size: 13.5px; color: var(--ink);
  display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.bucket-item:hover { background: #F0F3F5; }
.bucket-item.active { background: var(--ink); color: #fff; }
.bucket-item .pub-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); flex: none; }
.rail-foot { border-top: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.rail-link { text-align: left; border: none; background: transparent; padding: 8px 10px;
  border-radius: 7px; cursor: pointer; font-size: 14px; color: var(--ink-soft); font-family: inherit; }
.rail-link:hover { background: #F0F3F5; color: var(--ink); }

/* ---------- stage & pathbar ---------- */
.stage { padding: 22px 26px; overflow-x: auto; }
.panel { max-width: 1100px; }
.welcome { color: var(--ink-soft); padding-top: 40px; }
.pathbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.crumbs { font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; }
.crumb { background: none; border: none; cursor: pointer; font: inherit; color: var(--cobalt); padding: 2px 2px; }
.crumb:hover { text-decoration: underline; }
.crumb.current { color: var(--ink); cursor: default; text-decoration: none; }
.crumb-sep { color: var(--ink-soft); padding: 0 2px; }
.pathbar-actions { display: flex; gap: 8px; align-items: center; }
label.btn { display: inline-block; }

/* ---------- manifest table (signature element) ---------- */
.manifest { width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.manifest thead th { text-align: left; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #FAFBFC; }
.manifest td { padding: 10px 14px; border-bottom: 1px solid #EDF1F3; font-size: 14px; }
.manifest tbody tr { cursor: pointer; }
.manifest tbody tr:hover { background: #F5F8FA; }
.manifest tbody tr:last-child td { border-bottom: none; }
.col-type { width: 40px; }
.col-size, .col-date { width: 120px; color: var(--ink-soft); font-family: var(--font-mono); font-size: 13px; }
.col-date { width: 170px; }
.col-access { width: 100px; }
.type-glyph { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px;
  font-size: 10px; font-weight: 700; letter-spacing: .03em; background: #E8EDF1; color: var(--ink-soft); }
.type-glyph.folder { background: var(--ink); color: #fff; }
.type-glyph.img { background: #E3F0E6; color: #23663A; }
.type-glyph.vid { background: #E7E5F7; color: #4636A8; }
.name-cell { font-family: var(--font-mono); font-size: 13.5px; word-break: break-all; }
.badge { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 20px; }
.badge.public { background: var(--amber-wash); color: var(--amber); }
.badge.private { background: #EDF1F3; color: var(--ink-soft); }
.empty { padding: 48px; text-align: center; color: var(--ink-soft); background: var(--surface);
  border: 1px dashed var(--line); border-radius: var(--radius); margin-top: -1px; }
.load-more { margin: 14px auto 0; display: block; }

/* ---------- upload ---------- */
.upload-progress { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 14px; }
.upload-progress-label { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 8px; }
.bar { height: 6px; border-radius: 3px; background: #E4E9ED; overflow: hidden; }
.bar-fill { height: 100%; width: 0%; background: var(--cobalt); transition: width .15s; }
.drop-hint { border: 2px dashed var(--cobalt); border-radius: var(--radius); background: #EDF2FF;
  color: var(--cobalt-deep); text-align: center; padding: 26px; margin-bottom: 14px; font-weight: 600; }

/* ---------- drawer ---------- */
.drawer { width: 360px; background: var(--surface); border-left: 1px solid var(--line);
  padding: 18px; overflow-y: auto; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.drawer-head span { font-size: 13px; word-break: break-all; }
.drawer-preview { border-radius: 8px; overflow: hidden; background: #0E141A; margin-bottom: 14px; min-height: 40px;
  display: grid; place-items: center; }
.drawer-preview img, .drawer-preview video { display: block; width: 100%; max-height: 220px; object-fit: contain; }
.drawer-preview .no-preview { color: #8FA0AD; font-size: 12.5px; padding: 20px; }
.meta-list { font-size: 12.5px; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin-bottom: 14px; }
.meta-list dt { color: var(--ink-soft); }
.meta-list dd { word-break: break-all; }
.drawer-block { border-top: 1px solid var(--line); padding: 14px 0; }
.drawer-block-title { font-size: 11.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-soft); margin-bottom: 10px; }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.presign-result { margin-top: 10px; padding: 10px; background: #F4F6F8; border-radius: 8px;
  font-size: 12px; word-break: break-all; cursor: pointer; }
.presign-result:hover { background: #EDF1F4; }

/* ---------- keys panel ---------- */
.key-reveal { background: var(--amber-wash); border: 1px solid #EDD9AE; border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.key-reveal code { background: #fff; padding: 6px 10px; border-radius: 6px; font-size: 13px; word-break: break-all; }

/* ---------- modals & toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(23,34,44,.45); display: grid;
  place-items: center; z-index: 40; }
.modal { background: var(--surface); border-radius: 14px; padding: 28px; width: min(440px, 92vw);
  box-shadow: 0 24px 60px rgba(0,0,0,.2); }
.modal h2 { font-size: 20px; margin-bottom: 6px; }
.modal-actions { display: flex; gap: 8px; margin-top: 22px; align-items: center; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink);
  color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 14px; z-index: 60;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); }

@media (max-width: 900px) {
  .console { grid-template-columns: 1fr; }
  .rail { flex-direction: row; align-items: center; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line); }
  .rail-section { padding: 8px; } .rail-foot { border-top: none; flex-direction: row; }
  .drawer { position: fixed; right: 0; top: 0; bottom: 0; z-index: 30; box-shadow: -12px 0 30px rgba(0,0,0,.12); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
