:root {
  --ink: #102138;
  --ink-2: #1f3350;
  --paper: #f7f8fb;
  --card: #ffffff;
  --line: #d9dfeb;
  --brand: #1272c2;
  --brand-2: #11a39a;
  --warn: #b94a48;
  --text: #17253b;
  --muted: #5e6f87;
  --shadow: 0 14px 34px rgba(16, 33, 56, 0.11);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--paper);
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(80px);
  z-index: 0;
  pointer-events: none;
}
.bg-a {
  width: 420px;
  height: 420px;
  left: -130px;
  top: -140px;
  background: rgba(18, 114, 194, 0.18);
}
.bg-b {
  width: 500px;
  height: 500px;
  right: -180px;
  bottom: -220px;
  background: rgba(17, 163, 154, 0.18);
}

.layout {
  position: relative;
  z-index: 1;
  max-width: 1300px;
  margin: 0 auto;
  padding: 20px;
}

.hidden { display: none !important; }

.auth-shell { display: grid; place-items: center; min-height: calc(100vh - 40px); }
.auth-card {
  width: min(760px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px;
  box-shadow: var(--shadow);
  animation: rise .35s ease both;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 12px;
  color: var(--brand);
  font-weight: 800;
}
h1 { margin: 0 0 10px; font-size: 34px; line-height: 1.1; }
h2 { margin: 0 0 10px; font-size: 22px; }
.muted { color: var(--muted); margin: 0 0 12px; }
.small { font-size: 13px; }
.auth-status {
  min-height: 20px;
  margin-top: 8px;
  font-weight: 600;
  color: var(--warn);
}

.role-toggle { display: flex; gap: 10px; margin: 14px 0; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 700;
}
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.auth-grid, .form-grid { display: grid; gap: 10px; margin-bottom: 12px; }
.auth-grid { grid-template-columns: 1fr 1fr; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: #fff;
}
textarea { min-height: 90px; resize: vertical; }
label { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 7px; }

hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.btn.primary { background: linear-gradient(130deg, var(--brand), var(--brand-2)); color: #fff; }
.btn.ghost { background: #eaf1f8; color: var(--ink); }
.btn.danger { background: #fdeced; color: var(--warn); }
.btn:hover { transform: translateY(-1px); }

.app-shell { display: grid; grid-template-columns: 280px 1fr; gap: 16px; }
.sidebar {
  background: var(--ink);
  color: #fff;
  border-radius: 18px;
  padding: 18px;
  min-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sidebar .brand h2 { margin: 0; font-size: 26px; }
.sidebar .muted { color: rgba(255,255,255,.75); }
#menu { display: grid; gap: 7px; }
#menu .menu-btn {
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.06);
  color: #fff;
  border-radius: 10px;
  text-align: left;
  padding: 9px 12px;
  font-weight: 600;
  cursor: pointer;
}
#menu .menu-btn.active { background: #fff; color: var(--ink); }
#logout-btn { margin-top: auto; }

.workspace {
  background: transparent;
  min-height: calc(100vh - 40px);
}
.workspace-head {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.workspace-head h1 { margin: 0 0 4px; font-size: 28px; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  animation: rise .25s ease both;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}
th, td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}
th {
  background: #eff4fa;
  color: var(--ink-2);
  font-weight: 800;
}
tr:last-child td { border-bottom: none; }

.detail-box, .list-wrap {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fbfdff;
}

#log {
  margin: 0;
  background: #f1f6fb;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  min-height: 90px;
  white-space: pre-wrap;
}

.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.status-submitted { background: #fef4cc; color: #6f5a00; }
.status-approved { background: #dff4e3; color: #1f6a2b; }
.status-rejected { background: #fde8ea; color: #8c2830; }
.status-draft { background: #edf0f6; color: #405267; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1020px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; }
}
@media (max-width: 760px) {
  .auth-grid, .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
}
