:root {
  --base: #0E4B4F;
  --base-2: #0a3a3d;
  --accent: #C9A227;
  --bg: #f5f6f4;
  --card: #ffffff;
  --text: #1c2426;
  --muted: #6b7776;
  --line: #e3e7e5;
  --danger: #b3261e;
  --ok: #1b7a3c;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--base); }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 24px 0 10px; }
.muted { color: var(--muted); }
.center { min-height: 60vh; display: grid; place-items: center; }

/* Layout */
.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.side { background: var(--base); color: #fff; padding: 20px 12px; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 700; font-size: 18px; padding: 0 10px 18px; letter-spacing: .3px; }
.brand span { color: var(--accent); }
.side a { display: block; color: #d9e6e4; text-decoration: none; padding: 9px 12px; border-radius: 8px; margin: 2px 0; }
.side a:hover { background: var(--base-2); }
.side a.on { background: #fff; color: var(--base); font-weight: 600; }
.side .who { position: absolute; bottom: 16px; left: 12px; right: 12px; font-size: 12px; color: #b9cfcc; }
.side .who button { margin-top: 8px; width: 100%; }
main { padding: 28px 32px; max-width: 1300px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

/* Controls */
button, .btn {
  font: inherit; border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-block;
}
button:hover { border-color: #c9d1ce; }
button.primary, .btn.primary { background: var(--base); border-color: var(--base); color: #fff; }
button.danger { color: var(--danger); border-color: #efc9c6; }
button.danger.fill { background: var(--danger); color: #fff; border-color: var(--danger); }
button.small { padding: 4px 10px; font-size: 12.5px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; width: 100%;
}
textarea { min-height: 120px; resize: vertical; }
label { display: block; font-weight: 600; font-size: 12.5px; margin: 12px 0 5px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > input { width: auto; flex: 1; min-width: 220px; }

/* Panels */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; color: inherit; }
.stat b { display: block; font-size: 26px; color: var(--base); margin-top: 6px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button.on { background: var(--base); color: #fff; border-color: var(--base); }

/* Tables */
.tablewrap { overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #fafbfa; font-size: 12px; color: var(--muted); font-weight: 600; position: sticky; top: 0; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td .sub { color: var(--muted); font-size: 12px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; background: #eef1f0; white-space: nowrap; }
.pill.ok { background: #e3f3e8; color: var(--ok); }
.pill.bad { background: #fbe9e7; color: var(--danger); }
.pill.warn { background: #fbf3dc; color: #8a6a00; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* Login */
.login { max-width: 380px; margin: 10vh auto; }
.login .brand { color: var(--base); padding: 0 0 6px; font-size: 24px; }

/* Member card */
.bcard {
  width: 360px; max-width: 100%; aspect-ratio: 1.75; border-radius: 14px; padding: 22px; color: #fff;
  display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 10px 30px rgba(0,0,0,.15);
  background-size: cover; background-position: center; position: relative; overflow: hidden;
}
.bcard .top { display: flex; justify-content: space-between; align-items: flex-start; }
.bcard img.logo { max-height: 44px; max-width: 120px; object-fit: contain; }
.bcard img.avatar { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.6); }
.bcard .name { font-size: 20px; font-weight: 700; }
.bcard .line { border-top: 2px solid var(--accent-c, var(--accent)); width: 40px; margin: 6px 0; }

/* Modal + toast */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; z-index: 20; padding: 20px; }
.modal { background: #fff; border-radius: 12px; padding: 22px; width: 560px; max-width: 100%; max-height: 85vh; overflow: auto; }
.modal h3 { margin: 0 0 6px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #1c2426; color: #fff;
  padding: 10px 18px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 30; max-width: 90vw; }
#toast.show { opacity: 1; }
#toast.err { background: var(--danger); }

.notice { background: #fbf3dc; border: 1px solid #efdca4; padding: 14px 16px; border-radius: var(--radius); }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; display: flex; flex-wrap: wrap; gap: 4px; padding: 12px; }
  .side .brand { width: 100%; padding-bottom: 8px; }
  .side .who { position: static; width: 100%; }
  main { padding: 18px; }
}
