:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #dbe1ea;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --accent: #be123c;
  --soft: #e8f3f1;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

button,
a.icon-btn {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
}

button:hover,
a.icon-btn:hover {
  background: var(--brand-dark);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 36px 20px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 17px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
}

/* Logout button styling override */
.icon-btn.danger-btn {
  background: #be123c !important;
}

.icon-btn.danger-btn:hover {
  background: #9f1239 !important;
}

main {
  padding: 24px 36px 40px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.metric strong {
  display: block;
  font-size: 26px;
}

.metric.accent strong {
  color: var(--accent);
}

.dashboard {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.panel,
.content {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  font-size: 14px;
}

th {
  color: var(--muted);
  background: #f8fafc;
  font-size: 12px;
  font-weight: 800;
}

td.num,
th.num {
  text-align: right;
}

.split-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdff;
  margin-bottom: 8px;
}

.workspace {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.sidebar {
  display: grid;
  gap: 8px;
  position: sticky;
  top: 16px;
}

.tab {
  width: 100%;
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
  text-align: left;
  padding: 0 14px;
}

.tab.active {
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) 90px;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 10px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  color: var(--muted);
  white-space: nowrap;
}

.check input {
  width: 16px;
  min-height: 16px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding-bottom: 18px;
}

.settings-grid > div {
  border-right: 1px solid var(--line);
}

.settings-grid > div:last-child {
  border-right: 0;
}

.inline-form {
  display: grid;
  gap: 8px;
  padding: 14px 18px;
}

.chips {
  list-style: none;
  padding: 0 18px;
  margin: 0;
}

.chips li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.editing {
  background: #ecfeff;
}

.danger {
  width: 34px;
  min-height: 30px;
  color: #fff;
  background: #b91c1c;
}

.danger:hover {
  background: #991b1b;
}

.ghost {
  padding: 0 10px;
  color: var(--brand);
  background: var(--soft);
}

.ghost:hover {
  color: #fff;
  background: var(--brand);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  box-shadow: var(--shadow);
}

@media (max-width: 980px) {
  .app-header,
  main {
    padding-left: 18px;
    padding-right: 18px;
  }

  .summary-grid,
  .dashboard,
  .workspace,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .tab {
    text-align: center;
    padding: 0 8px;
  }

  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary-grid,
  .split-lists,
  .form-grid,
  .sidebar {
    grid-template-columns: 1fr;
  }

  .metric strong {
    font-size: 22px;
  }
}

/* Auth Pages Styling (login.php / signup.php) */
.auth-body {
  background: #0c111d; /* Matches admin portal background */
  color: #f8fafc;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
  background-image: radial-gradient(circle at top right, rgba(15, 118, 110, 0.15), transparent),
                    radial-gradient(circle at bottom left, rgba(190, 18, 60, 0.05), transparent);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
}

.auth-container {
  max-width: 440px;
  width: 100%;
}

.auth-card {
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.auth-card h2 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #fff;
  letter-spacing: -0.02em;
}

.auth-card p.subtitle {
  color: #94a3b8;
  font-size: 14px;
  margin-bottom: 30px;
}

.auth-form {
  text-align: left;
}

.auth-form .form-group {
  margin-bottom: 20px;
}

.auth-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 8px;
}

.auth-form input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  outline: none;
  font-size: 14px;
  transition: all 0.3s ease;
}

.auth-form input:focus {
  border-color: #0f766e;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 10px rgba(15, 118, 110, 0.2);
}

.auth-form button[type="submit"] {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 0;
  background: #0f766e;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  font-size: 15px;
  margin-top: 10px;
  transition: background 0.3s ease;
}

.auth-form button[type="submit"]:hover {
  background: #115e59;
}

.auth-footer {
  margin-top: 24px;
  font-size: 14px;
  color: #94a3b8;
}

.auth-footer a {
  color: #0f766e;
  text-decoration: none;
  font-weight: 600;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.auth-error {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: #fb7185;
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  margin-bottom: 20px;
  text-align: center;
}
