* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #f4f5f7;
  color: #1f2933;
}
main { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }
main.full { max-width: none; margin: 0; padding: 0; }
h1 { font-size: 1.4rem; }
.muted { color: #6b7280; font-size: 0.9rem; }
.warn { color: #b45309; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: .6rem; flex-wrap: wrap;
  background: linear-gradient(#1c5fb8, #4a8fd8);
  color: #fff; padding: 0.5rem 1rem;
  border-bottom: 1px solid #123c78;
  box-shadow: 0 2px 6px rgba(10, 30, 60, .25);
}
.topbar .tb-left {
  display: flex; align-items: center; gap: .55rem; min-width: 0;
  flex: 1 1 auto; order: 1;
}
.topbar .ico-nav {
  width: 22px; height: 22px; border-radius: 5px; flex: 0 0 22px;
  display: block; object-fit: contain;
  box-shadow: 0 1px 3px rgba(0,0,0,.35);
}
.topbar .brand {
  font-weight: 700; color: #fff; text-decoration: none; white-space: nowrap;
  font-family: Tahoma, Verdana, "Segoe UI", sans-serif;
}
.topbar .brand-sub { font-weight: 400; color: #d6e7fb; font-size: .85rem; }
.topbar .tb-caption {
  font-weight: 700; color: #fff; font-size: .9rem; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 40vw;
  font-family: Tahoma, Verdana, sans-serif;
}
.topbar nav {
  display: flex; align-items: center; gap: .35rem; flex-wrap: wrap;
  order: 2;
}
.topbar nav a {
  color: #eaf3ff; margin-left: .3rem; text-decoration: none; font-size: .9rem;
  padding: .15rem .45rem; border-radius: 3px;
}
.topbar nav a:hover { color: #fff; background: rgba(255,255,255,.18); }
.topbar .tb-user {
  color: #dcebff; font-size: .82rem; margin-left: .5rem;
  padding: .1rem .45rem; border-left: 1px solid rgba(255,255,255,.35);
}
.topbar a.quit {
  color: #eaf3ff; text-decoration: none; font-size: .9rem; border-radius: 3px;
  background: #d94f3d; border: 1px solid #7a281e; font-weight: 700;
  padding: 0 .4rem; margin-left: .5rem; flex: 0 0 auto; order: 3;
}
.topbar a.quit:hover { color: #fff; background: #e05e4d; }
.mode-form { display: inline; margin: 0; }
.mode-btn {
  border: 2px outset #cfe0f5; border-radius: 3px; cursor: pointer;
  font: 12px Tahoma, sans-serif; padding: 3px 10px;
  background: #d4d0c8; color: #111;
}
.mode-btn.on { background: #ffe9a8; border-color: #e0c060; font-weight: 700; }
.mode-btn.off { background: #d4d0c8; }
.mode-btn:hover { filter: brightness(1.05); }
.write-banner {
  background: #fff4d6; border-bottom: 1px solid #e6c976; color: #6b4e00;
  padding: .45rem 1rem; font-size: .88rem;
}

button, .btn {
  display: inline-block; border: 1px solid #c4cdd8; background: #fff;
  border-radius: 6px; padding: 0.4rem 0.9rem; font-size: 0.9rem;
  cursor: pointer; text-decoration: none; color: #1f2933;
}
button:hover, .btn:hover { background: #eef2f6; }
button.primary, .btn.primary { background: #1668b4; border-color: #1668b4; color: #fff; }
button.primary:hover { background: #12548f; }
button:disabled, .btn:disabled { opacity: 0.6; cursor: not-allowed; }
button.danger { background: #fff; border-color: #d64545; color: #d64545; }
button.danger:hover { background: #fdecec; }

.login-body {
  display: grid; place-items: center; min-height: 100vh; padding: 1.25rem;
  background:
    radial-gradient(circle at 18% 18%, rgba(74, 143, 216, 0.35), transparent 42%),
    radial-gradient(circle at 82% 80%, rgba(28, 95, 184, 0.4), transparent 46%),
    linear-gradient(135deg, #0b1f3a 0%, #12396b 52%, #1b59a8 100%);
}
.login-shell { width: min(440px, 100%); }
.login-card {
  background: #ffffff; border-radius: 16px; width: 100%; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 22px 60px rgba(5, 18, 38, 0.45), 0 4px 16px rgba(10, 30, 60, 0.2);
  display: flex; flex-direction: column;
}
.login-banner {
  background: linear-gradient(135deg, #133b70 0%, #1c5fb8 60%, #3a82d6 100%);
  color: #fff; padding: 1.5rem 1.75rem 1.25rem;
  border-bottom: 3px solid #f0b429;
}
.login-brand-row { display: flex; align-items: center; gap: 1rem; }
.login-emblem {
  position: relative; width: 54px; height: 54px; flex: 0 0 54px;
  border-radius: 14px; background: rgba(11, 34, 68, 0.45);
  border: 1px solid rgba(255, 209, 102, 0.45);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 4px 12px rgba(0,0,0,0.2);
  display: flex; align-items: center; justify-content: center;
}
.login-flame-svg {
  width: 38px; height: 38px; display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}
.login-brand-txt { min-width: 0; }
.login-kicker {
  display: block; font-size: 0.68rem; font-weight: 700; letter-spacing: 1.1px;
  color: #bcd9ff; text-transform: uppercase; margin-bottom: 0.15rem;
}
.login-banner h1 {
  margin: 0; color: #fff; font-size: 1.35rem; letter-spacing: 0.3px;
  font-family: Tahoma, Verdana, "Segoe UI", sans-serif;
}
.login-nav-sub {
  margin: 0.18rem 0 0; font-size: 0.82rem; color: #e2eeff; opacity: 0.92;
}
.login-pills {
  display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1rem;
}
.login-pills span {
  font-size: 0.72rem; background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22); color: #f0f7ff;
  padding: 0.22rem 0.55rem; border-radius: 999px; white-space: nowrap;
}
.login-content {
  padding: 1.5rem 1.75rem 1.4rem;
  display: flex; flex-direction: column; gap: 1rem;
}
.login-intro h2 {
  margin: 0 0 0.3rem; font-size: 1.08rem; color: #12395b;
}
.login-intro p {
  margin: 0; font-size: 0.86rem; line-height: 1.45; color: #52606d;
}
.login-field { display: flex; flex-direction: column; gap: 0.35rem; }
.login-field label {
  font-size: 0.83rem; font-weight: 600; color: #243b53;
}
.login-input-wrap {
  position: relative; display: flex; align-items: center;
}
.login-ico {
  position: absolute; left: 0.75rem; font-size: 0.95rem;
  pointer-events: none; opacity: 0.75;
}
.login-card input[type="text"],
.login-card input[type="password"] {
  width: 100%; padding: 0.68rem 0.8rem 0.68rem 2.35rem;
  border: 1px solid #cbd5e1; border-radius: 8px;
  font-size: 0.95rem; color: #1f2933; background: #f8fafc;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.login-card input[type="text"]:focus,
.login-card input[type="password"]:focus {
  outline: none; border-color: #1c5fb8; background: #fff;
  box-shadow: 0 0 0 3px rgba(28, 95, 184, 0.16);
}
.login-btn {
  padding: 0.72rem 1rem; font-size: 0.96rem; font-weight: 600;
  border-radius: 8px; margin-top: 0.2rem;
  background: linear-gradient(180deg, #1e6cd0 0%, #1557ac 100%);
  box-shadow: 0 3px 10px rgba(21, 87, 172, 0.28);
  transition: transform 0.1s, box-shadow 0.15s, filter 0.15s;
}
.login-btn:hover:not(:disabled) {
  filter: brightness(1.05);
  box-shadow: 0 5px 14px rgba(21, 87, 172, 0.36);
}
.login-btn:active:not(:disabled) { transform: translateY(1px); }
.login-footer {
  border-top: 1px solid #e8edf2; padding-top: 0.75rem; margin-top: 0.15rem;
  font-size: 0.76rem; color: #64748b; text-align: center; line-height: 1.35;
}
.login-error {
  background: #fdecec; color: #b91c1c; border: 1px solid #f5b5b5;
  padding: 0.55rem 0.85rem; border-radius: 8px; margin: 0; font-size: 0.88rem;
}
.hp-wrap {
  position: absolute; left: -9999px; width: 1px; height: 1px;
  overflow: hidden; opacity: 0; pointer-events: none;
}

.filter { width: 100%; max-width: 420px; padding: 0.55rem; margin-bottom: 1rem;
  border: 1px solid #c4cdd8; border-radius: 6px; }
.table-list { columns: 3; list-style: none; padding: 0; }
.table-list li { break-inside: avoid; margin-bottom: 0.35rem; }
.table-list a { color: #1668b4; text-decoration: none; }
.table-list a:hover { text-decoration: underline; }

.page-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.page-head .table-name { flex: 1 1 auto; word-break: break-all; }
.search { display: flex; gap: 0.5rem; }
.search input { padding: 0.45rem; border: 1px solid #c4cdd8; border-radius: 6px; min-width: 260px; }

.grid-wrap { overflow-x: auto; background: #fff; border: 1px solid #dde3ea;
  border-radius: 8px; }
.grid { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
.grid th, .grid td { border-bottom: 1px solid #e8edf2; padding: 0.45rem 0.7rem;
  text-align: left; white-space: nowrap; }
.grid th { background: #f0f4f8; position: sticky; top: 0; }
.grid tr:hover td { background: #f7fafc; }
.actions { text-align: right; }
.actions button { margin-left: 0.35rem; padding: 0.25rem 0.6rem; font-size: 0.82rem; }
.payload { white-space: normal; max-width: 420px; word-break: break-all; font-family: monospace; font-size: 0.78rem; }

.pager { display: flex; align-items: center; gap: 1rem; margin: 1rem 0; }

dialog {
  border: none; border-radius: 10px; padding: 1.5rem; width: min(560px, 92vw);
  box-shadow: 0 20px 60px rgba(15, 40, 70, 0.35);
}
dialog::backdrop { background: rgba(15, 25, 40, 0.45); }
.fields { display: flex; flex-direction: column; gap: 0.6rem; max-height: 55vh;
  overflow-y: auto; margin: 1rem 0; }
.fields label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.85rem; }
.fields input { padding: 0.45rem; border: 1px solid #c4cdd8; border-radius: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; }

.toast {
  position: fixed; bottom: 1.2rem; right: 1.2rem; padding: 0.8rem 1.2rem;
  border-radius: 8px; color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  transition: opacity 0.3s; max-width: 480px;
}
.toast.ok { background: #1c7a3d; }
.toast.err { background: #b91c1c; }
.toast.hidden { opacity: 0; pointer-events: none; }

@media (max-width: 900px) {
  .table-list { columns: 1; }
  .search input { min-width: 0; }
  main { padding: 0.9rem; }
  .topbar { padding: 0.45rem 0.7rem; }
  .topbar .tb-left { order: 1; flex: 1 1 0; min-width: 0; }
  .topbar a.quit { order: 2; margin-left: auto; font-size: .82rem; }
  .topbar nav { order: 3; flex: 1 0 100%; width: 100%; }
  .topbar .brand-sub { display: none; }
  .topbar .tb-caption { max-width: 55vw; font-size: .82rem; }
  .topbar nav a { font-size: .82rem; margin-left: 0; }
}

.read-hint { font-size: .85rem; }
