:root {
  --bg: #101216;
  --bg2: #161a22;
  --card: #1e2430;
  --card2: #252c3b;
  --line: #323a4c;
  --text: #f3f1ea;
  --muted: #a8b0be;
  --amber: #f0b429;
  --amber2: #d49a14;
  --ink: #1a1408;
  --ok: #3ecf8e;
  --danger: #f07178;
  --info: #6cb6ff;
  --warn: #ff9f43;
  --radius: 18px;
  --tap: 64px;
  --nav: 80px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 18px; line-height: 1.4; }
body { min-height: 100dvh; padding-bottom: calc(var(--nav) + env(safe-area-inset-bottom)); }
body.no-nav { padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--amber); text-decoration: none; }
img, video { max-width: 100%; border-radius: 12px; }
button, input, select, textarea { font: inherit; color: inherit; }

.offline-bar {
  position: sticky; top: 0; z-index: 50;
  background: #5a3a00; color: #ffe7a8;
  text-align: center; font-weight: 700;
  padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top));
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  background: linear-gradient(180deg, #1a1f28, transparent);
  gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--amber); font-weight: 800; }
.top-title { font-size: 1.15rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-user { color: var(--muted); font-weight: 700; font-size: .95rem; }
.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--card); color: var(--text); font-size: 1.8rem; font-weight: 700;
}
.wrap { padding: 8px 16px 24px; max-width: 860px; margin: 0 auto; }

.flash { padding: 14px 16px; border-radius: 14px; margin: 8px 0 14px; font-weight: 700; }
.flash-ok { background: #163528; color: #b6ffd9; }
.flash-danger { background: #3a1c22; color: #ffc9c9; }
.flash-warn { background: #3a2a10; color: #ffdba0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 0 14px;
  box-shadow: var(--shadow);
}
.card-link { display: block; color: inherit; }
.card h2, .card h3 { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: .92rem; }
.center { text-align: center; }
.row-between { display: flex; justify-content: space-between; gap: 10px; align-items: center; }

.hero-logo { width: 84px; height: 84px; display: block; margin: 12px auto 8px; }
.login-box { padding-top: 24px; }

label { display: block; font-weight: 800; margin: 16px 0 8px; }
.req { color: var(--amber); }

input:not([type]),
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="search"],
input[type="url"],
input[type="datetime-local"],
select,
textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: var(--tap);
  margin: 0;
  padding: 16px 18px;
  background: #0c1016;
  color: var(--text);
  border: 2px solid #3d4658;
  border-radius: 16px;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
textarea { min-height: 132px; resize: vertical; line-height: 1.45; }
select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'><path fill='%23f0b429' d='M5 7l5 6 5-6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 48px;
}
input[type="date"] { color-scheme: dark; }
input::placeholder,
textarea::placeholder {
  color: #8b95a6;
  opacity: 1;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--amber);
  background: #121820;
  box-shadow: 0 0 0 4px rgba(240, 180, 41, .22);
}
input:disabled,
textarea:disabled,
select:disabled {
  opacity: .55;
}
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: #f3f1ea;
  caret-color: #f3f1ea;
  border-color: #3d4658;
  box-shadow: 0 0 0 1000px #0c1016 inset;
  transition: background-color 99999s ease-out;
}
.hint { color: var(--muted); font-size: .88rem; margin: 8px 0 0; }

.btn, button.btn, a.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap);
  width: 100%;
  border: 0;
  border-radius: 16px;
  font-weight: 800;
  font-size: 1.12rem;
  padding: 12px 16px;
  margin: 10px 0 0;
  cursor: pointer;
  text-align: center;
  -webkit-user-select: none;
  user-select: none;
}
.btn-amber { background: var(--amber); color: var(--ink); }
.btn-amber:active { background: var(--amber2); }
.btn-ok { background: var(--ok); color: #062016; }
.btn-danger { background: var(--danger); color: #2a0b0e; }
.btn-info { background: var(--info); color: #041526; }
.btn-ghost { background: var(--card2); color: var(--text); border: 2px solid var(--line); }
.btn-outline { background: transparent; color: var(--amber); border: 2px solid var(--amber); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.btn-row .btn { margin-top: 0; }
.btn-row form { margin: 0; }
.btn-col { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.btn-col .btn { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 16px; }
.stack .btn, .stack .btn-row, .stack form { margin: 0; }
.btn[disabled] { opacity: .5; }

.pill { display: inline-block; padding: 6px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.pill-ok { background: #163528; color: var(--ok); }
.pill-warn { background: #3a2a10; color: var(--warn); }
.pill-muted { background: #2a2f3a; color: var(--muted); }
.pill-danger { background: #3a1c22; color: var(--danger); }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border-radius: 16px; padding: 14px; border: 1px solid var(--line); }
.stat b { display: block; font-size: 1.45rem; }
.stat span { color: var(--muted); font-size: .85rem; font-weight: 700; }

.work-card { position: relative; overflow: hidden; }
.work-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--amber);
}
.work-card h3 { margin: 0 0 6px; font-size: 1.2rem; }
.list-gap { display: flex; flex-direction: column; gap: 12px; }

.choice {
  display: block; margin: 0 0 10px;
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: block; background: var(--card2); border: 3px solid var(--line);
  border-radius: 16px; padding: 16px; min-height: 72px;
  font-weight: 800;
}
.choice input:checked + span { border-color: var(--amber); background: #3a2e12; }
.choice small { display: block; font-weight: 600; color: var(--muted); margin-top: 4px; }

.stepper { display: grid; grid-template-columns: 88px 1fr 88px; gap: 10px; align-items: center; }
.stepper-btn {
  height: 88px; border: 0; border-radius: 16px; background: var(--amber); color: var(--ink);
  font-size: 2.4rem; font-weight: 800; cursor: pointer;
}
.stepper input { text-align: center; font-size: 1.8rem; font-weight: 800; min-height: 88px; }

.gps {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg2); border-radius: 14px; padding: 12px 14px; margin: 10px 0;
  font-weight: 700;
}
.gps.ok { color: var(--ok); }
.gps.wait { color: var(--warn); }
.gps.bad { color: var(--danger); }
.dot { width: 12px; height: 12px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }

.media-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.file-btn { position: relative; overflow: hidden; margin-top: 0; }
.file-btn input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 100%;
}
.thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.thumbs img, .thumbs video { width: 100%; height: 120px; object-fit: cover; }

.preview-list, .file-block { margin-top: 12px; }
.preview-item, .file-block {
  background: #0c1016;
  border: 2px solid #3d4658;
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 10px;
}
.preview-item img, .file-block img,
.preview-item video, .file-block video {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  background: #000;
  border-radius: 12px;
}
.pdf-frame {
  width: 100%;
  height: 240px;
  border: 0;
  border-radius: 12px;
  background: #fff;
}
.preview-name { font-weight: 800; margin: 10px 0 8px; word-break: break-word; }
.file-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 12px;
  background: #161c28;
  border-radius: 12px;
}
.file-chip b {
  flex: 0 0 auto;
  min-width: 56px;
  text-align: center;
  background: var(--amber);
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 8px;
  font-size: .85rem;
}
.file-chip span { font-weight: 700; word-break: break-word; }
.vis-hide {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: #12151c; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  min-height: var(--nav);
}
.tabbar a {
  color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: .72rem; font-weight: 800; padding: 8px 2px; min-height: 64px;
}
.tabbar a.active { color: var(--amber); }
.tab-ico { font-size: 1.2rem; line-height: 1; }
.tab-plus .plus {
  width: 52px; height: 52px; border-radius: 50%; background: var(--amber); color: var(--ink);
  display: flex; align-items: center; justify-content: center; font-size: 2rem; margin-top: -18px;
  box-shadow: 0 8px 20px rgba(240,180,41,.35);
}
.tab-plus span:last-child { margin-top: -2px; }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.62); z-index: 80;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom));
}
.modal[hidden] { display: none; }
.modal-card { background: var(--card); width: 100%; max-width: 520px; border-radius: 22px; padding: 20px; }
.modal-card h3 { margin: 0 0 8px; font-size: 1.3rem; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: .8rem; text-transform: uppercase; }

.queue-chip {
  position: fixed; right: 16px; bottom: calc(var(--nav) + 12px + env(safe-area-inset-bottom));
  background: var(--warn); color: #2a1600; font-weight: 800;
  padding: 10px 14px; border-radius: 999px; z-index: 45; display: none;
}
.audio-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.kvs { display: grid; gap: 8px; }
.kvs div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
.kvs b { font-weight: 800; }

.search { margin-bottom: 12px; }

@media (min-width: 880px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .btn { max-width: none; }
  body { font-size: 17px; }
  .wrap { padding-top: 12px; }
}
@media (min-width: 1100px) {
  .tabbar { left: 50%; transform: translateX(-50%); max-width: 860px; border-radius: 18px 18px 0 0; }
}
