:root {
  --brand: #D48033;
  --brand-hover: #b86927;
  --ink: #202A23;
  --text: #303a33;
  --muted: #69726b;
  --canvas: #F6F5F1;
  --surface: #fff;
  --line: #d9ddd5;
  --success: #24734a;
  --danger: #b43f36;
  --warning: #a65e18;
  --focus: #2459b9;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --font-display: Manrope, Arial, sans-serif;
  --font-body: "DM Sans", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--text); font: 16px/1.5 var(--font-body); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, p { margin-top: 0; }
h1, h2 { font-family: var(--font-display); color: var(--ink); letter-spacing: -.04em; font-weight: 500; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.skip { position: absolute; left: 12px; top: 12px; transform: translateY(-140%); background: #fff; color: var(--ink); padding: 8px 12px; z-index: 5; }
.skip:focus { transform: none; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 32px 18px; }
.login-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 32px 28px; }
.login-card img { width: 148px; height: auto; }
.eyebrow { margin: 22px 0 0; font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--brand); }
.login-card h1 { margin: 8px 0 12px; font-size: 40px; }
.login-card p { color: var(--muted); }
.login-card form { display: grid; gap: 14px; margin-top: 22px; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink); }
.field input, .field select, .field textarea, .inline select {
  min-height: 46px;
  border: 1px solid #bfc7bd;
  border-radius: 6px;
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 400;
}
.field textarea { min-height: 96px; resize: vertical; }
.login-card .error, .error { color: var(--danger); font-size: 13px; font-weight: 700; min-height: 1.2em; }
.btn, .quiet, .text-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}
.btn { background: var(--brand); color: #fff; }
.btn:hover, .btn:focus-visible { background: var(--brand-hover); }
.quiet { background: transparent; border-color: var(--ink); color: var(--ink); }
.text-btn { background: transparent; color: #fff; border-color: #ffffff55; }
.login-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; font-size: 14px; }

.portal { min-height: 100vh; }
.side {
  background: var(--ink);
  color: #fff;
  padding: 18px;
}
.side img { width: 132px; height: auto; filter: brightness(0) invert(1); }
.who { margin: 14px 0; color: #c5cdc4; font-size: 13px; }
.side nav { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.side a {
  color: #fff;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.side a:hover, .side a:focus-visible, .side nav a[aria-current="page"] { background: #ffffff1a; }
.side nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--brand); }
a.metric { display: block; color: inherit; text-decoration: none; }
a.metric:hover, a.metric:focus-visible { border-color: var(--brand); }
.count { margin-left: 6px; color: var(--brand); }
.side .text-btn { margin-top: 8px; }

.main { padding: 28px 18px 72px; }
.main h1 { font-size: clamp(36px, 5vw, 56px); margin: 0 0 8px; }
.lead { max-width: 68ch; color: var(--muted); margin-bottom: 22px; }
.metrics { display: grid; gap: 12px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.metric strong { display: block; font-family: var(--font-display); font-size: 32px; letter-spacing: -.04em; color: var(--ink); }
.metric span { font-size: 13px; color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px 8px; margin-top: 16px; }
.panel-head + .panel { margin-top: 0; }
.panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: end; flex-wrap: wrap; margin-bottom: 12px; }
.panel h2 { font-size: 28px; margin: 0; }
.inline { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
th, td { text-align: left; padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
th { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--canvas); }
.cell-name { font-family: var(--font-display); font-size: 17px; color: var(--ink); letter-spacing: -.03em; }
.cell-time { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell-quiet { color: var(--muted); }
.panel th:nth-child(5), .panel td:nth-child(5),
.panel th:last-child, .panel td:last-child { width: 1%; white-space: nowrap; }
td select { min-height: 44px; width: 100%; }
.status-menu { position: relative; }
.status-menu > button.badge {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 196px;
  min-height: 44px;
  padding: 0 14px 0 16px;
  border: 0;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.status-menu > button.badge::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
}
.status-list {
  position: fixed;
  z-index: 40;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px #202a231f;
}
.status-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}
.status-option .mark { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; }
.status-option.ok .mark { background: var(--success); }
.status-option.wait .mark { background: var(--warning); }
.status-option.stop .mark { background: var(--danger); }
.status-option.plain .mark { background: var(--muted); }
.status-option .icon { width: 16px; height: 16px; margin-left: auto; }
.status-option:hover, .status-option:focus-visible { background: var(--canvas); }
.status-option[aria-selected="true"] { background: var(--canvas); }
.panel table .quiet {
  min-height: 44px;
  padding: 8px 2px;
  border-color: transparent;
  background: transparent;
}
.panel table .quiet:hover, .panel table .quiet:focus-visible { color: var(--brand); background: transparent; }
.panel .empty { padding: 16px 8px; }

@media (max-width: 800px) {
  .panel table { min-width: 0; }
  .panel thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .panel table, .panel tbody, .panel tr, .panel td { display: block; width: auto; }
  .panel tr { padding: 14px 6px; border-bottom: 1px solid var(--line); }
  .panel td { border: 0; padding: 6px 4px; white-space: normal; }
  .panel td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .panel td.cell-name { order: -1; padding-top: 0; }
  .panel td.cell-name::before, .panel td:last-child::before { content: none; }
  .panel tr { display: flex; flex-direction: column; }
  .panel td:last-child { align-self: start; }
  .status-menu, .status-menu > button.badge { width: 100%; }
  .panel th:nth-child(5), .panel td:nth-child(5),
  .panel th:last-child, .panel td:last-child { width: auto; }
  .panel tbody tr:hover td { background: transparent; }
  .panel tbody tr:last-child { border-bottom: 0; }
}
.badge { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #fbefe2; color: #96521c; }
.badge.ok { background: #e0f1e5; color: var(--success); }
.badge.wait { background: #f8ecdc; color: var(--warning); }
.badge.stop { background: #fbe7e5; color: var(--danger); }
.badge.plain { background: #eeeee8; color: var(--ink); }
.empty { color: var(--muted); margin: 0; }
.folder-path { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 18px 0 8px; }
.folder-path button { min-height: 44px; padding: 8px 2px; border: 0; background: none; color: var(--ink); font-weight: 700; }
.folder-path button:hover, .folder-path button:focus-visible { color: var(--brand); }
.folder-path [aria-current="page"] { color: var(--muted); font-weight: 600; }
.folder-create { display: grid; gap: 12px; margin: 8px 0 16px; }
.folder-create .btn { justify-self: start; }
.folder-create .status { min-height: 0; }
.file-pick { position: relative; margin: 0 0 16px; cursor: pointer; }
.file-pick input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.files { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.files:empty { display: none; }
.files li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 8px 8px 14px;
}
.file-open {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 2px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  text-align: left;
}
.file-open .icon { width: 22px; height: 22px; flex: none; }
.file-open span { min-width: 0; overflow-wrap: anywhere; }
.file-open:hover, .file-open:focus-visible { color: var(--brand); }
.files p { margin: 0; color: var(--muted); font-size: 13px; white-space: nowrap; }
.files .actions { margin-left: auto; flex: none; }
#driveLink { margin-top: 12px; }
#driveLink:empty { display: none; }
.folders { list-style: none; padding: 14px 0 0; margin: 0; display: grid; gap: 28px 16px; }
.folders li {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0 14px 14px 14px;
  padding: 16px 14px 10px;
  display: grid;
  gap: 4px;
  align-content: start;
  min-width: 0;
}
.folders li::before {
  content: "";
  position: absolute;
  left: -1px;
  top: -12px;
  width: 76px;
  height: 14px;
  background: var(--brand);
  border-radius: 8px 10px 0 0;
}
.folders p { margin: 0; color: var(--muted); font-size: 13px; }
.folder-open {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 2px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  text-align: left;
}
.folder-open .icon { width: 28px; height: 28px; color: var(--brand); flex: none; }
.folder-open span { min-width: 0; overflow-wrap: anywhere; }
.folder-open:hover, .folder-open:focus-visible { color: var(--brand); }
.folders .actions { gap: 2px; margin-top: 4px; }
.icon-btn {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
}
.icon-btn .icon { width: 20px; height: 20px; }
.icon-btn:hover, .icon-btn:focus-visible,
.icon-btn[aria-pressed="true"] { background: var(--canvas); color: var(--brand); }
.icon-btn[data-icon="trash-2"]:hover,
.icon-btn[data-icon="trash-2"]:focus-visible { color: var(--danger); }
.folder-rename, .folder-move { display: grid; gap: 8px; }
.folder-rename input, .folder-move select { min-height: 46px; border: 1px solid #bfc7bd; border-radius: 6px; padding: 12px 14px; background: #fff; color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.team .panel { padding: 18px 18px 16px; }
.team .panel h2 { font-size: 22px; margin: 2px 0 16px; }
.team .lead { margin-bottom: 18px; }
.user-list { list-style: none; padding: 0; margin: 0; display: grid; }
.user-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px 16px;
  align-items: center;
  padding: 14px 2px;
  border-bottom: 1px solid var(--line);
}
.user-list li:last-child { border-bottom: 0; }
.user-person { display: grid; gap: 2px; min-width: 0; }
.user-person strong { font-family: var(--font-display); font-weight: 500; font-size: 18px; letter-spacing: -.03em; color: var(--ink); }
.user-person span, .user-note { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.user-note { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.user-list .quiet { min-height: 44px; }
.user-form, .drive-form { display: grid; gap: 12px; margin-top: 8px; }
.team .user-form { margin-top: 0; }
.activity { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.activity li { display: grid; gap: 2px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.activity span { color: var(--muted); font-size: 13px; }
.diary-day { margin-top: 22px; }
.diary-day h2 { margin: 0 0 8px; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.diary .activity { gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; }
.diary .activity li { grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; align-items: center; padding: 14px 0; }
.diary .activity li:last-child { border-bottom: 0; }
.diary .badge { justify-self: start; }
.diary-copy { display: grid; gap: 2px; min-width: 0; }
.diary-copy strong { font-family: var(--font-display); font-size: 18px; font-weight: 500; letter-spacing: -.03em; color: var(--ink); }
.diary-copy span, .diary .activity time, .diary-who { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.diary .activity time { grid-column: 2; font-variant-numeric: tabular-nums; }
.diary-who { grid-column: 2; }
.status { color: var(--ink); font-weight: 700; min-height: 1.2em; }
dialog { width: min(520px, calc(100% - 24px)); border: 1px solid var(--line); border-radius: 12px; padding: 22px; background: #fff; color: var(--text); }
dialog::backdrop { background: #09100bcc; }
dialog h2 { font-size: 28px; margin-bottom: 8px; }
dialog p { color: var(--muted); }
.hint { font-size: 13px; }

@media (min-width: 800px) {
  .portal { display: grid; grid-template-columns: 240px minmax(0, 1fr); }
  .side { position: sticky; top: 0; height: 100vh; overflow: auto; display: flex; flex-direction: column; padding: 26px 18px; }
  .side nav { display: grid; gap: 4px; overflow: visible; }
  .side a { justify-content: space-between; }
  .side .text-btn { margin-top: auto; }
  .main { padding: 36px 32px 80px; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .folder-create { grid-template-columns: minmax(220px, 360px) auto; align-items: end; }
  .folder-create .status { grid-column: 1 / -1; }
  .folders { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .diary .activity li { grid-template-columns: 168px minmax(0, 1fr) 64px minmax(96px, 180px); gap: 8px 16px; }
  .diary .activity time, .diary-who { grid-column: auto; }
  .diary .activity time { text-align: right; }
  .diary-who { text-align: right; }
}

@media (min-width: 900px) {
  .team .user-form { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; }
  .team .user-form h2,
  .team .user-form .hint,
  .team .user-form .status { grid-column: 1 / -1; }
  .team .user-form .btn { justify-self: start; }
}
@media (max-width: 640px) {
  .user-list li { grid-template-columns: auto auto; justify-content: start; align-items: center; }
  .user-person { grid-column: 1 / -1; }
}

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 12px; }
.filters .field { min-width: min(100%, 220px); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.xml { overflow: auto; max-height: 420px; margin: 0; padding: 14px; background: var(--ink); color: #f6f5f1; border-radius: 12px; font: 13px/1.55 ui-monospace, Consolas, monospace; white-space: pre; }
.xml .tag { color: #f0b27a; }
dialog.wide { width: min(880px, calc(100% - 24px)); max-height: calc(100vh - 48px); overflow: auto; }
.choice-list { display: grid; gap: 8px; margin: 8px 0 0; padding: 0; list-style: none; }
.choice-list button { text-align: left; }
.check-grid { display: grid; gap: 8px; }
.stack { display: grid; gap: 14px; }
.note { color: var(--muted); font-size: 14px; }
.url-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.url-line code { overflow-wrap: anywhere; }
#tool .metrics { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
}
