/* ==========================================================================
   Staff document area. Shares the tokens from apple.css but is deliberately
   plainer than the public site — this is a tool, not a shopfront.
   ========================================================================== */

.admin-body { background: var(--offwhite); }

/* The browser's own `[hidden] { display: none }` sits in the UA stylesheet, so
   any author `display` rule beats it — .admin-gate below sets display:grid and
   would otherwise stay on screen after signing in. This wins that fight. */
[hidden] { display: none !important; }

/* ---------- LOGIN ---------- */
.admin-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-card {
  width: 100%; max-width: 400px; background: var(--white);
  border: 1px solid var(--gray-line); border-radius: 22px;
  padding: 40px 38px; text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
}
.gate-logo { margin: 0 auto 22px; height: 48px; width: auto; }
.gate-card h1 { font-size: 1.5rem; margin-bottom: 8px; }
.gate-sub { font-size: 0.88rem; color: var(--gray-soft); font-weight: 500; margin-bottom: 26px; }
.gate-sub a { color: var(--blue); font-weight: 600; }
.gate-card label { display: block; text-align: left; font-size: 0.82rem; font-weight: 600; margin-bottom: 7px; }
.gate-card input {
  width: 100%; padding: 13px 15px; font: inherit; font-size: 0.95rem;
  border: 1px solid var(--gray-line); border-radius: 12px; background: var(--white);
  margin-bottom: 18px;
}
.gate-card input:focus-visible { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.18); }
.gate-card .btn-fill { width: 100%; justify-content: center; }
.gate-status { margin-top: 14px; font-size: 0.85rem; font-weight: 600; min-height: 1.2em; color: #b3261e; }

/* ---------- APP CHROME ---------- */
.admin-bar { background: var(--white); border-bottom: 1px solid var(--gray-line); position: sticky; top: 0; z-index: 50; }
.admin-bar-inner {
  max-width: 1180px; margin: 0 auto; padding: 14px 26px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
.admin-brand { display: flex; align-items: center; gap: 14px; }
.admin-brand img { height: 34px; width: auto; }
.admin-brand span { font-weight: 700; letter-spacing: -0.02em; font-size: 0.95rem; }
.admin-actions { display: flex; align-items: center; gap: 16px; }
.admin-link { font-size: 0.88rem; font-weight: 600; color: var(--gray-soft); }
.admin-link:hover { color: var(--blue); }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }

.admin-main { max-width: 1180px; margin: 0 auto; padding: 34px 26px 80px; }

/* ---------- DROP ZONE ---------- */
.drop-zone {
  border: 2px dashed var(--gray-line); border-radius: 22px; background: var(--white);
  padding: 46px 26px; text-align: center;
  transition: border-color .25s var(--ease), background .25s var(--ease);
}
.drop-zone.over { border-color: var(--blue); background: rgba(0, 113, 227, 0.05); }
.drop-zone svg { width: 42px; height: 42px; color: var(--blue); margin-bottom: 14px; }
.drop-zone h2 { font-size: 1.2rem; margin-bottom: 6px; }
.drop-zone p { font-size: 0.92rem; color: var(--gray-soft); font-weight: 500; }
.drop-note { font-size: 0.8rem !important; margin-top: 10px; opacity: 0.8; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); font-weight: 600; cursor: pointer; text-decoration: underline; }

/* ---------- UPLOAD LOG ---------- */
.upload-log { margin-top: 18px; display: grid; gap: 10px; }
.upload-row {
  display: flex; align-items: center; gap: 12px; background: var(--white);
  border: 1px solid var(--gray-line); border-radius: 12px; padding: 12px 16px; font-size: 0.88rem; font-weight: 500;
}
.upload-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-row .st { font-weight: 600; font-size: 0.82rem; }
.upload-row.ok .st { color: #1a7f37; }
.upload-row.err { border-color: rgba(179, 38, 30, 0.4); }
.upload-row.err .st { color: #b3261e; }
.upload-row.busy .st { color: var(--gray-soft); }

/* ---------- FILE LIST ---------- */
.files-section { margin-top: 40px; }
.files-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.files-head h2 { font-size: 1.25rem; }
.files-head .count { color: var(--gray-soft); font-weight: 600; font-size: 0.95rem; }
.files-tools { display: flex; gap: 10px; align-items: center; }
.files-tools input {
  padding: 9px 14px; font: inherit; font-size: 0.88rem; min-width: 220px;
  border: 1px solid var(--gray-line); border-radius: 980px; background: var(--white);
}
.files-tools input:focus-visible { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.18); }

.file-list { display: grid; gap: 10px; }
.file-row {
  display: flex; align-items: center; gap: 16px; background: var(--white);
  border: 1px solid var(--gray-line); border-radius: 14px; padding: 15px 20px;
  transition: border-color .2s var(--ease);
}
.file-row:hover { border-color: var(--blue); }
.file-icon { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 10px; background: rgba(0, 113, 227, 0.1); color: var(--blue); font-size: 0.62rem; font-weight: 800; letter-spacing: 0.03em; }
.file-meta { flex: 1; min-width: 0; }
.file-meta .fn { font-weight: 600; font-size: 0.94rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta .fd { font-size: 0.8rem; color: var(--gray-soft); font-weight: 500; margin-top: 2px; }
.file-row .row-actions { display: flex; gap: 8px; flex: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--gray-line); background: var(--white); color: var(--gray-soft); cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
.icon-btn.danger:hover { background: #b3261e; border-color: #b3261e; }
.empty-state { text-align: center; color: var(--gray-soft); font-weight: 500; padding: 44px 0; }

@media (max-width: 620px) {
  .files-head { align-items: flex-start; flex-direction: column; }
  .files-tools input { min-width: 0; flex: 1; }
  .admin-bar-inner { padding: 12px 18px; }
  .admin-brand span { display: none; }
  .admin-main { padding: 24px 18px 60px; }
}

/* ---------- TABS ---------- */
.admin-tabs { display: flex; gap: 4px; background: var(--offwhite); padding: 4px; border-radius: 980px; }
.admin-tabs .tab {
  border: 0; background: none; font: inherit; font-size: 0.88rem; font-weight: 600;
  color: var(--gray-soft); padding: 8px 20px; border-radius: 980px; cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.admin-tabs .tab:hover { color: var(--gray); }
.admin-tabs .tab.active { background: var(--white); color: var(--gray); box-shadow: 0 2px 8px rgba(0,0,0,.08); }

/* ---------- ADD LINK ---------- */
.add-link-card { background: var(--white); border: 1px solid var(--gray-line); border-radius: 20px; padding: 26px 28px; }
.add-link-card h2 { font-size: 1.15rem; margin-bottom: 18px; }
.link-form { display: grid; gap: 14px; }
.lf-row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.lf-field { display: flex; flex-direction: column; gap: 6px; min-width: 170px; }
.lf-grow { flex: 1; }
.lf-field label { font-size: 0.78rem; font-weight: 600; }
.lf-field .opt { color: var(--gray-soft); font-weight: 500; }
.lf-field input {
  padding: 11px 14px; font: inherit; font-size: 0.9rem;
  border: 1px solid var(--gray-line); border-radius: 12px; background: var(--white);
}
.lf-field input:focus-visible { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,113,227,.18); }
.link-form .btn-fill { padding: 11px 24px; }
#linkStatus { margin-top: 0; }

.fav-toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 0.85rem; font-weight: 600; color: var(--gray-soft); cursor: pointer; white-space: nowrap; }
.fav-toggle input { width: 16px; height: 16px; accent-color: var(--blue); }

/* ---------- LINK ROWS ---------- */
.link-host { font-size: 0.8rem; color: var(--gray-soft); font-weight: 500; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-note { font-size: 0.82rem; color: var(--gray-soft); font-weight: 500; margin-top: 4px; }
.pill { display: inline-block; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--blue); background: rgba(0,113,227,.1); padding: 3px 9px; border-radius: 980px; margin-left: 8px; vertical-align: 1px; }
.star-btn { border: 0; background: none; cursor: pointer; padding: 6px; color: var(--gray-line); transition: color .2s var(--ease), transform .2s var(--ease); }
.star-btn svg { width: 20px; height: 20px; }
.star-btn:hover { transform: scale(1.12); color: #e8b021; }
.star-btn.on { color: #f0b429; }
.file-row.fav { border-color: rgba(240,180,41,.55); background: linear-gradient(0deg, rgba(240,180,41,.05), rgba(240,180,41,.05)), var(--white); }
.fav-head { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-soft); margin: 4px 0 2px; }

/* ---------- VIEWER ---------- */
.viewer { position: fixed; inset: 0; z-index: 200; background: rgba(20,20,22,.82); display: flex; flex-direction: column; }
.viewer-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 20px; background: var(--white); border-bottom: 1px solid var(--gray-line); flex: none;
}
.viewer-name { font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-actions { display: flex; gap: 10px; flex: none; }
.viewer-body { flex: 1; overflow: auto; background: var(--offwhite); }
.viewer-body iframe { width: 100%; height: 100%; border: 0; background: var(--white); display: block; }
.viewer-body img { max-width: 100%; margin: 24px auto; display: block; background: var(--white); }
.doc-render { background: var(--white); max-width: 900px; margin: 26px auto; padding: 46px 54px; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.12); font-size: 0.95rem; line-height: 1.6; }
.doc-render table { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
.doc-render table td, .doc-render table th { border: 1px solid var(--gray-line); padding: 6px 10px; text-align: left; }
.doc-render table tr:first-child { background: var(--offwhite); font-weight: 600; }
.doc-render h1, .doc-render h2, .doc-render h3 { margin: 1em 0 .4em; }
.doc-render p { margin-bottom: .7em; }
.doc-render img { max-width: 100%; }
.sheet-tabs { display: flex; gap: 6px; flex-wrap: wrap; max-width: 900px; margin: 24px auto -10px; }
.sheet-tabs button { border: 1px solid var(--gray-line); background: var(--white); font: inherit; font-size: .8rem; font-weight: 600; padding: 6px 14px; border-radius: 980px; cursor: pointer; }
.sheet-tabs button.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.viewer-msg { color: #fff; text-align: center; padding: 80px 24px; font-weight: 500; }
.viewer-msg strong { display: block; font-size: 1.1rem; margin-bottom: 8px; }

@media (max-width: 860px) {
  .admin-bar-inner { flex-wrap: wrap; }
  .admin-tabs { order: 3; width: 100%; justify-content: center; }
  .doc-render { padding: 26px 22px; margin: 14px; }
}

/* ---------- FOLDERS ---------- */
.docs-layout { display: grid; grid-template-columns: 236px 1fr; gap: 22px; align-items: start; }
.folder-pane { background: var(--white); border: 1px solid var(--gray-line); border-radius: 16px; padding: 14px; position: sticky; top: 96px; }
.folder-pane-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 8px 12px; border-bottom: 1px solid var(--gray-line); margin-bottom: 10px; }
.folder-pane-head span { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-soft); }
.folder-tree { display: grid; gap: 2px; max-height: 60vh; overflow: auto; }
.folder-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  border: 0; background: none; font: inherit; font-size: .88rem; font-weight: 500;
  color: var(--gray); padding: 8px 10px; border-radius: 9px; cursor: pointer;
  transition: background .15s var(--ease);
}
.folder-item:hover { background: var(--offwhite); }
.folder-item.on { background: rgba(0,113,227,.1); color: var(--blue); font-weight: 600; }
.folder-item.drop-target { background: rgba(0,113,227,.18); box-shadow: inset 0 0 0 2px var(--blue); }
.folder-item svg { width: 16px; height: 16px; flex: none; color: var(--blue); }
.folder-item .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-item .ct { font-size: .75rem; color: var(--gray-soft); font-weight: 500; }
.folder-item .del { opacity: 0; padding: 2px; border-radius: 5px; color: var(--gray-soft); }
.folder-item:hover .del { opacity: 1; }
.folder-item .del:hover { color: #b3261e; }

.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; font-size: .88rem; font-weight: 500; }
.crumbs button { border: 0; background: none; font: inherit; color: var(--blue); cursor: pointer; padding: 2px 4px; border-radius: 6px; font-weight: 600; }
.crumbs button:hover { background: var(--offwhite); }
.crumbs .sep { color: var(--gray-line); }
.crumbs .here { color: var(--gray-soft); font-weight: 600; padding: 2px 4px; }

.file-row.dragging { opacity: .45; }
.file-row[draggable="true"] { cursor: grab; }
.move-select {
  font: inherit; font-size: .8rem; padding: 7px 10px; border-radius: 9px;
  border: 1px solid var(--gray-line); background: var(--white); color: var(--gray-soft); cursor: pointer; max-width: 150px;
}
.move-select:hover { border-color: var(--blue); color: var(--gray); }
.row-folder { font-size: .75rem; color: var(--blue); font-weight: 600; }

@media (max-width: 820px) {
  .docs-layout { grid-template-columns: 1fr; }
  .folder-pane { position: static; }
  .folder-tree { max-height: 220px; }
}

/* ---------- Reviews panel ---------- */
.panel-note { color: var(--gray-soft, #6e6e73); font-size: .92rem; margin: -6px 0 16px; max-width: 62ch; }
.rv-admin-row { align-items: flex-start; gap: 16px; }
.rv-admin-main { flex: 1 1 auto; min-width: 0; }
.rv-admin-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.rv-admin-name { font-size: .95rem; }
.rv-admin-stars { letter-spacing: 1px; font-size: .95rem; }
.rv-admin-stars .on { color: #ff9f0a; }
.rv-admin-stars .off { color: #d2d2d7; }
.rv-admin-text {
  color: var(--gray-soft, #6e6e73); font-size: .9rem; line-height: 1.5;
  white-space: pre-line; display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 3; overflow: hidden;
}
.rv-admin-actions { display: flex; gap: 4px; flex: none; }
.rv-admin-actions .icon-btn[disabled] { opacity: .3; pointer-events: none; }
#reviewText { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid #d2d2d7;
  border-radius: 10px; resize: vertical; }
.settings-card { max-width: 720px; }

.gate-forgot { margin-top: 14px; text-align: center; }
.gate-forgot .link-btn { font-size: .9rem; }

/* ---------- Recovery code ---------- */
.code-panel { text-align: center; padding: 26px 22px; }
.code-panel.inline { text-align: left; margin-top: 22px; padding: 20px 22px;
  border: 1px solid #d2d2d7; border-radius: 14px; background: #f5f5f7; max-width: 640px; }
.code-panel h2, .code-panel h3 { margin-bottom: 8px; }
.code-panel p { color: var(--gray-soft, #6e6e73); font-size: .92rem; margin-bottom: 14px; max-width: 60ch; }
.code-value {
  display: block; margin: 0 0 16px; padding: 14px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.15rem; letter-spacing: .06em; word-break: break-all;
  background: #fff; border: 1px solid #d2d2d7; border-radius: 10px;
}
