:root {
  --orange: #ff4d00;
  --orange-deep: #d63e00;
  --ink: #111;
  --mute: #6b6b6b;
  --line: #e6e6e6;
  --bg: #f3f4f6;
  --side: #0f1115;
  --card: #fff;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: system-ui, "Segoe UI", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; }

.shell { display: grid; height: 100%; grid-template-columns: 248px 1fr; overflow: hidden; }
.side { background: var(--side); color: #fff; padding: 18px 14px; display: flex; flex-direction: column; height: 100%; overflow: auto; }
.brand { display: flex; justify-content: flex-start; padding: 2px 8px 18px; }
.brand img { height: 48px; width: auto; max-width: 168px; object-fit: contain; object-position: left center; background: #fff; border-radius: 8px; padding: 5px 8px; }
.nav-label { margin: 14px 10px 6px; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.35); }
.side a { display: flex; align-items: center; gap: 10px; border-radius: 10px; padding: 10px 12px; color: rgba(255,255,255,.7); font-size: 13.5px; font-weight: 600; }
.side a:hover { background: #1a1d24; color: #fff; }
.side a.on { background: #ff4d00; color: #fff; }
.main { min-width: 0; height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.topbar { height: 64px; flex-shrink: 0; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; }
.crumbs { font-size: 18px; color: var(--ink); }
.crumbs b { color: var(--ink); font-weight: 700; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.userchip { font-size: 13px; font-weight: 700; background: #111; color: #fff; border-radius: 999px; padding: 8px 12px; }
.body { padding: 24px; flex: 1; overflow: auto; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.pagehead h1 { margin: 0; font-size: 26px; letter-spacing: 0; font-weight: 700; }
.pagehead p { margin: 4px 0 0; color: var(--mute); font-size: 13px; }
.tabs { display: inline-flex; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.tabs a { border-radius: 10px; padding: 8px 14px; font-size: 13px; font-weight: 700; color: #333; }
.tabs a.on { background: #111; color: #fff; }
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fff; }
.toolbar .count { font-size: 13px; font-weight: 700; }
.toolbar-right { display: flex; gap: 10px; align-items: center; margin-left: auto; }
.toolbar input, .toolbar select {
  border: 1px solid #ddd; background: #fafafa; border-radius: 10px; padding: 9px 12px; min-width: 220px;
}
.pager { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 14px; }
.icon-btn { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; background: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: #222; }
.icon-btn svg { width: 16px; height: 16px; }
.remark-view { margin: 0 0 4px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.is-hidden { display: none !important; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px; padding: 9px 14px; font-size: 13px; font-weight: 700; cursor: pointer; }
.btn-orange { background: var(--orange); color: #fff; }
.btn-orange:hover { background: var(--orange-deep); }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: #222; }
.btn-danger { background: #fff; border: 1px solid #ffd0d0; color: #c01616; }
.btn-danger:hover { background: #fff5f5; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.stat b { display: block; font-size: 28px; letter-spacing: -.03em; }
.stat span { color: var(--mute); font-size: 12px; font-weight: 600; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; font-weight: 700; border-bottom: 1px solid var(--line); }
.details { margin: 0; }
.detail { padding: 12px 18px; border-bottom: 1px solid #f1f1f1; }
.detail:last-child { border-bottom: 0; }
.detail dt { margin: 0 0 4px; font-size: 12px; font-weight: 700; color: var(--mute); }
.detail dd { margin: 0; font-size: 14px; font-weight: 600; word-break: break-word; }
.hint { margin: 8px 0 0; color: #777; font-size: 12px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; font-size: 14px; font-weight: 700; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: #d5d5d5; border-radius: 999px; cursor: pointer; transition: .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + i { background: #157a3a; }
.switch input:checked + i::after { transform: translateX(20px); }
.modal { display: none; position: fixed; inset: 0; z-index: 80; background: rgba(17,17,17,.45); padding: 20px; place-items: center; }
.modal.open { display: grid; }
.modal-card { width: min(560px, 100%); background: #fff; border-radius: 16px; padding: 22px; max-height: 90vh; overflow: auto; }
.modal-wide { width: min(640px, 100%); }
.field.check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.field.check input { width: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { margin: 0; font-size: 20px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 12px; font-weight: 700; color: var(--mute); padding: 12px 14px; background: #fafafa; border-bottom: 1px solid var(--line); }
td { padding: 12px 14px; border-bottom: 1px solid #f1f1f1; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.thumb { width: 52px; height: 38px; object-fit: cover; border-radius: 8px; background: #eee; }
.badge { display: inline-flex; border-radius: 999px; padding: 3px 8px; font-size: 11px; font-weight: 700; }
.badge-ok { background: #e9f8ee; color: #157a3a; }
.badge-warn { background: #fff3e8; color: #c05600; }
.badge-mute { background: #f2f2f2; color: #555; }
.row-actions { display: flex; gap: 8px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 700; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid #ddd; background: #fafafa; border-radius: 10px; padding: 11px 12px; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: #111; background: #fff; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; align-items: start; }
.upload { border: 1px dashed #d3d3d3; border-radius: 12px; padding: 16px; background: #fafafa; text-align: center; }
.upload img { width: 100%; height: 180px; object-fit: cover; border-radius: 10px; margin-bottom: 10px; }
.upload-full img { height: auto; max-height: 140px; object-fit: contain; background: #fff; }
body.login-page { overflow: auto; background: #111; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #111; }
.login-card {
  width: min(820px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
}
.login-brand {
  display: grid;
  place-items: center;
  padding: 48px 36px;
  background: #f7f7f7;
  border-right: 1px solid var(--line);
}
.login-brand img { width: min(240px, 100%); height: auto; display: block; }
.login-form { padding: 42px 36px; }
.login-form h1 { margin: 0 0 6px; font-size: 26px; font-weight: 700; }
.login-sub { margin: 0 0 20px; color: var(--mute); font-size: 13px; }
.login-btn { width: 100%; }
.slide-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.slide-card { display: flex; flex-direction: column; }
.slide-thumb { width: 100%; height: auto; aspect-ratio: auto; object-fit: contain; background: #111; display: block; }
.slide-body { padding: 10px; min-width: 0; }
.slide-body b { display: block; margin-bottom: 6px; font-size: 13px; }
.slide-card .btn { padding: 5px 9px; font-size: 12px; }
.slide-card .row-actions { margin-top: 8px; }
.slide-body p { margin: 0 0 3px; font-size: 12px; color: #222; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.slide-body p span { color: var(--mute); font-weight: 700; margin-right: 6px; }
.popup-card { max-width: 420px; }
.popup-card .upload-full img { max-height: none; width: 100%; height: auto; object-fit: contain; }
.err { color: #c00; font-size: 13px; margin-bottom: 10px; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { flex-direction: row; height: auto; overflow: auto; align-items: center; }
  .brand, .nav-label { display: none; }
  .side a { white-space: nowrap; }
  .stats, .grid2, .form-grid { grid-template-columns: 1fr; }
  .slide-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .slide-grid { grid-template-columns: 1fr 1fr; }
  .login-card { grid-template-columns: 1fr; }
  .login-brand { padding: 28px 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .login-brand img { width: 180px; }
  .login-form { padding: 28px 22px; }
}
