/* Linear-style theme — midnight precision instrument */
:root {
  --void: #08090a;
  --carbon: #0f1011;
  --obsidian: #161718;
  --graphite: #23252a;
  --smoke: #383b3f;
  --ash: #62666d;
  --fog: #8a8f98;
  --mist: #d0d6e0;
  --bone: #e5e5e6;
  --paper: #ffffff;
  --lime: #e4f222;
  --green: #27a644;
  --coral: #eb5757;
  --teal: #02b8cc;
  --iris: #6366f1;
  --lavender: #8b5cf6;

  --font-sans: "Inter", "Pretendard Variable", Pretendard, ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --r-badge: 4px;
  --r-ctl: 6px;
  --r-card: 12px;

  --hairline: inset 0 0 0 1px var(--graphite);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, .4);
  --shadow-xl: 0 4px 32px rgba(8, 9, 10, .6);
}

*, *::before, *::after { box-sizing: border-box; }
[x-cloak] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--void);
  color: var(--mist);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: "cv01" on, "ss03" on, "zero" on;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--mist); outline-offset: 2px; border-radius: var(--r-ctl); }

.icon { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 20px; height: 20px; }
.mono { font-family: var(--font-mono); font-size: 12px; letter-spacing: -0.013em; font-variant-numeric: tabular-nums; }
.muted { color: var(--fog); }
.faint { color: var(--ash); }

/* ---------- Brand ---------- */
.mark {
  width: 24px; height: 24px; border-radius: var(--r-ctl);
  display: grid; place-items: center;
  background: var(--paper); color: var(--void);
}
.mark .icon { width: 14px; height: 14px; stroke-width: 2.2; }
.mark-lg { width: 40px; height: 40px; border-radius: 10px; }
.mark-lg .icon { width: 20px; height: 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--paper); font-size: 15px; font-weight: 510; letter-spacing: -0.011em; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--r-ctl);
  font-size: 13px; font-weight: 400; white-space: nowrap;
  transition: background-color .12s, color .12s, box-shadow .12s;
}
.btn-primary {
  background: var(--lime); color: var(--void); font-weight: 510; letter-spacing: -0.011em;
  box-shadow: 0 5px 2px rgba(0,0,0,.01), 0 3px 2px rgba(0,0,0,.04), 0 1px 1px rgba(0,0,0,.07);
}
.btn-primary:hover { background: #ecf74f; }
.btn-primary:disabled { background: var(--graphite); color: var(--ash); box-shadow: none; }
.btn-ghost { color: var(--mist); box-shadow: var(--hairline); }
.btn-ghost:hover { background: rgba(255,255,255,.04); }
.btn-ghost:disabled { color: var(--ash); background: none; }
.btn-text { color: var(--fog); padding: 0 8px; }
.btn-text:hover { color: var(--paper); background: rgba(255,255,255,.04); }
.btn-danger { background: var(--coral); color: var(--paper); font-weight: 510; }
.btn-danger:hover { background: #f06b6b; }
.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 40px; padding: 0 16px; font-size: 14px; }
.btn-block { width: 100%; }

.icon-btn {
  width: 28px; height: 28px; border-radius: var(--r-ctl);
  display: inline-grid; place-items: center; color: var(--ash);
  transition: background-color .12s, color .12s;
}
.icon-btn:hover { color: var(--paper); background: rgba(255,255,255,.06); }
.icon-btn.danger:hover { color: var(--coral); background: rgba(235,87,87,.1); }
.btn > span, .icon-btn > span { display: inline-flex; align-items: center; }

/* ---------- Inputs ---------- */
.input {
  height: 32px; padding: 0 10px; border-radius: var(--r-ctl);
  background: rgba(255,255,255,.02); border: 1px solid rgba(255,255,255,.08);
  color: var(--mist); font-size: 13px; outline: none; min-width: 0;
  transition: border-color .12s, background-color .12s;
}
.input::placeholder { color: var(--ash); }
.input:focus { border-color: var(--mist); background: rgba(255,255,255,.03); }
.input-lg { height: 40px; padding: 0 14px; font-size: 14px; width: 100%; }

/* ---------- Surfaces ---------- */
.card { background: var(--carbon); border-radius: var(--r-card); box-shadow: var(--hairline); }
.badge {
  display: inline-flex; align-items: center; height: 18px; padding: 0 6px;
  border-radius: var(--r-badge); background: rgba(255,255,255,.05);
  color: var(--fog); font-size: 12px; line-height: 1;
}

/* ---------- Notices ---------- */
.notice {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px; border-radius: var(--r-ctl);
  font-size: 13px; line-height: 1.45;
  background: rgba(255,255,255,.03); box-shadow: var(--hairline); color: var(--mist);
}
.notice .icon { margin-top: 1px; }
.notice-error { background: rgba(235,87,87,.08); box-shadow: inset 0 0 0 1px rgba(235,87,87,.25); }
.notice-error .icon { color: var(--coral); }
.notice-info .icon { color: var(--fog); }

.toast {
  position: fixed; top: 16px; right: 16px; z-index: 50;
  width: min(320px, calc(100vw - 32px));
  background: var(--obsidian); border-radius: var(--r-card);
  box-shadow: var(--hairline), var(--shadow-xl);
  padding: 14px 14px 14px 16px;
  display: flex; gap: 10px; align-items: flex-start;
}
.toast-title { color: var(--paper); font-size: 13px; font-weight: 510; }
.toast-body { color: var(--fog); font-size: 12px; margin-top: 2px; }
.toast-actions { margin-top: 10px; }

/* ---------- App shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(8, 9, 10, .85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 0.5px solid var(--graphite);
}
.topbar-inner, .page {
  max-width: 1040px; margin: 0 auto; padding-left: 24px; padding-right: 24px;
}
.topbar-inner { height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar-nav { display: flex; align-items: center; gap: 4px; }
.topbar-nav form { margin: 0; }

.page { padding-top: 32px; padding-bottom: 64px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-title { margin: 0; color: var(--paper); font-size: 24px; font-weight: 510; letter-spacing: -0.012em; line-height: 1.33; }
.page-sub { margin-top: 4px; color: var(--fog); font-size: 13px; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.head-actions form { display: flex; gap: 8px; margin: 0; }

/* ---------- Breadcrumb ---------- */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font-size: 13px; color: var(--fog); margin-bottom: 12px; }
.crumbs a { display: inline-flex; align-items: center; gap: 6px; padding: 2px 6px; border-radius: var(--r-badge); transition: color .12s, background-color .12s; }
.crumbs a:hover { color: var(--paper); background: rgba(255,255,255,.04); }
.crumbs a[aria-current] { color: var(--paper); }
.crumbs .sep { color: var(--smoke); }

/* ---------- Dropzone ---------- */
.dropzone {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 16px;
  padding: 20px 24px; margin-bottom: 24px;
  border-radius: var(--r-card); cursor: pointer;
  background: var(--carbon);
  border: 1px dashed var(--smoke);
  transition: border-color .15s, background-color .15s;
}
.dropzone:hover { border-color: var(--ash); }
.dropzone.is-over { border-color: var(--mist); background: var(--obsidian); }
.dropzone.is-busy { cursor: progress; border-style: solid; border-color: var(--graphite); }
.dz-icon {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center;
  background: rgba(255,255,255,.04); box-shadow: var(--hairline); color: var(--mist);
}
.dz-title { color: var(--paper); font-size: 14px; font-weight: 510; }
.dz-sub { color: var(--fog); font-size: 12px; margin-top: 2px; }
.dz-sub code { font-family: var(--font-mono); color: var(--mist); }
.dz-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--graphite); }
.dz-progress > i { display: block; height: 100%; background: var(--paper); transition: width .15s ease-out; }
.dz-done { color: var(--green); }

/* ---------- File table ---------- */
.table-card { overflow: hidden; }
.ftable { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.ftable th {
  height: 36px; padding: 0 16px; text-align: left;
  color: var(--ash); font-size: 12px; font-weight: 400;
  border-bottom: 0.5px solid var(--graphite);
}
.ftable td { height: 44px; padding: 0 16px; border-bottom: 0.5px solid var(--graphite); vertical-align: middle; }
.ftable tbody tr:last-child td { border-bottom: 0; }
.ftable tbody tr { transition: background-color .1s; }
.ftable tbody tr:hover { background: rgba(255,255,255,.02); }
.ftable .col-size { width: 96px; text-align: right; }
.ftable .col-date { width: 148px; text-align: right; }
.ftable .col-act { width: 168px; text-align: right; }
.ftable td.col-size, .ftable td.col-date { color: var(--ash); }

.fname { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fname-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--mist); }
a.fname-text:hover { color: var(--paper); text-decoration: underline; text-decoration-color: var(--smoke); text-underline-offset: 3px; }
.ftile {
  width: 28px; height: 28px; border-radius: var(--r-ctl); flex-shrink: 0;
  display: grid; place-items: center; background: rgba(255,255,255,.04);
  color: var(--fog);
}
.ftile.t-dir { color: var(--mist); }
.ftile.t-img { color: var(--teal); }
.ftile.t-vid { color: var(--lavender); }
.ftile.t-aud { color: var(--coral); }
.ftile.t-zip { color: var(--iris); }
.ftile.t-pdf { color: var(--coral); }
.ftile.t-bin { color: var(--lime); }
.ftile.t-code { color: var(--green); }

.acts { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.confirm { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.confirm-q { color: var(--mist); font-size: 12px; white-space: nowrap; }

.empty { padding: 56px 24px; text-align: center; }
.empty .ftile { width: 40px; height: 40px; margin: 0 auto 12px; border-radius: 10px; box-shadow: var(--hairline); }
.empty-title { color: var(--mist); font-size: 14px; font-weight: 510; }
.empty-sub { color: var(--ash); font-size: 13px; margin-top: 4px; }

.inline-error { margin-top: 12px; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-box { width: 100%; max-width: 360px; }
.auth-head { text-align: center; margin-bottom: 24px; }
.auth-head .mark { margin: 0 auto 16px; }
.auth-title { margin: 0; color: var(--paper); font-size: 20px; font-weight: 510; letter-spacing: -0.012em; }
.auth-sub { margin-top: 6px; color: var(--fog); font-size: 13px; }
.auth-card { padding: 24px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { color: var(--mist); font-size: 13px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-toggle { position: absolute; top: 6px; right: 6px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.auth-foot { margin-top: 20px; text-align: center; color: var(--ash); font-size: 12px; }

/* ---------- Token page ---------- */
.token {
  font-family: var(--font-mono); font-size: 12px; line-height: 1.7; word-break: break-all;
  color: var(--paper); background: var(--void); box-shadow: var(--hairline);
  border-radius: var(--r-ctl); padding: 12px 14px; user-select: all;
}
.snippet {
  font-family: var(--font-mono); font-size: 12px; line-height: 1.7; color: var(--fog);
  background: var(--void); box-shadow: var(--hairline); border-radius: var(--r-ctl);
  padding: 10px 12px; white-space: pre-wrap; word-break: break-all;
}
.label { color: var(--ash); font-size: 12px; margin-bottom: 6px; display: flex; align-items: center; justify-content: space-between; }

/* ---------- Spin ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin .8s linear infinite; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .topbar-inner, .page { padding-left: 16px; padding-right: 16px; }
  .page { padding-top: 24px; }
  .ftable .col-date { display: none; }
  .ftable .col-size { width: 76px; }
  .ftable .col-act { width: 96px; }
  .ftable th, .ftable td { padding: 0 10px; }
  .hide-sm { display: none !important; }
  .dropzone { padding: 16px; }
  .head-actions, .head-actions form { width: 100%; }
  .head-actions .input { flex: 1; }
}
