:root {
  color-scheme: dark;
  --bg: #0f141d;
  --surface: #151c29;
  --surface-2: #1d2738;
  --line: #2b384f;
  --text: #edf5ff;
  --muted: #9fb0cb;
  --blue: #3375e8;
  --green: #43d17a;
  --yellow: #f4c35b;
  --red: #ff657d;
  --shadow: 0 18px 45px rgba(0, 0, 0, .35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(51, 117, 232, .20), transparent 34rem),
    radial-gradient(circle at top right, rgba(67, 209, 122, .10), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(11, 16, 24, .82);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.brand img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.brand strong {
  display: block;
  font-size: 1.05rem;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: .82rem;
  margin-top: .15rem;
}

main {
  width: min(1120px, calc(100% - 2rem));
  margin: 1.4rem auto 4rem;
}

.hidden {
  display: none !important;
}

.login-card,
.panel,
.summary-grid article {
  background: linear-gradient(180deg, rgba(29, 39, 56, .98), rgba(18, 25, 37, .98));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.login-card {
  width: min(520px, 100%);
  margin: 10vh auto 0;
  padding: 1.5rem;
}

.eyebrow {
  margin: 0 0 .45rem;
  color: #56f19a;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .12em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: .6rem;
  font-size: clamp(1.8rem, 7vw, 2.8rem);
}

h2 {
  margin-bottom: .2rem;
  font-size: clamp(1.35rem, 5vw, 2rem);
}

h3 {
  margin-bottom: .4rem;
}

.muted {
  color: var(--muted);
  line-height: 1.65;
}

label {
  display: block;
  margin-top: 1rem;
  color: #d8e5fb;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  margin-top: .45rem;
  padding: .9rem 1rem;
  background: #101723;
  color: var(--text);
  border: 1px solid #31415e;
  border-radius: 12px;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(51, 117, 232, .18);
}

.primary,
.secondary,
.danger,
.ghost {
  min-height: 42px;
  padding: .75rem 1rem;
  border-radius: 12px;
  color: white;
  font-weight: 800;
}

.primary {
  width: 100%;
  margin-top: 1.2rem;
  background: linear-gradient(135deg, #3275e9, #245ac1);
}

.secondary {
  background: #22314a;
  border: 1px solid #3a4d70;
}

.danger {
  background: #8d2740;
}

.ghost {
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
}

.message {
  min-height: 1.4rem;
  margin: 1rem 0 0;
  color: #67e8f9;
  font-weight: 800;
}

.message[data-kind="error"] {
  color: var(--red);
}

.message[data-kind="success"] {
  color: var(--green);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .9rem;
  margin-bottom: 1rem;
}

.summary-grid article {
  padding: 1rem;
}

.summary-grid span {
  display: block;
  color: var(--muted);
  margin-bottom: .35rem;
}

.summary-grid strong {
  font-size: 1.7rem;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .4rem;
  padding: .35rem;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 14px;
}

.tab {
  padding: .8rem .4rem;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.tab.active {
  background: var(--blue);
  color: white;
}

.panel {
  padding: 1rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.search {
  margin: 0 0 1rem;
}

.card-list {
  display: grid;
  gap: .8rem;
}

.admin-card {
  padding: 1rem;
  background: #111927;
  border: 1px solid #2a3953;
  border-radius: 16px;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .8rem;
}

.card-title {
  font-weight: 900;
  font-size: 1.05rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.badge {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: .28rem .55rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 900;
}

.badge.ok {
  background: rgba(67, 209, 122, .16);
  color: #65f5a1;
}

.badge.warn {
  background: rgba(244, 195, 91, .16);
  color: #ffd36d;
}

.badge.danger {
  background: rgba(255, 101, 125, .16);
  color: #ff8fa2;
}

.meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
  margin: .9rem 0;
}

.meta div {
  min-width: 0;
  padding: .65rem;
  background: rgba(255, 255, 255, .045);
  border-radius: 12px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.meta span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  margin-bottom: .2rem;
}

.order-code {
  display: inline-block;
  max-width: 100%;
  font-family: Consolas, "Roboto Mono", monospace;
  letter-spacing: 0;
  color: #edf5ff;
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
}

.actions.full {
  grid-template-columns: 1fr;
}

.mini-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: .45rem;
  margin-top: .8rem;
}

.mini-form input {
  margin: 0;
  min-width: 0;
}

.log-box {
  min-height: 360px;
  max-height: 62vh;
  overflow: auto;
  padding: 1rem;
  background: #080d15;
  border: 1px solid #26354e;
  border-radius: 14px;
  color: #cfe2ff;
  white-space: pre-wrap;
}

@media (max-width: 760px) {
  main {
    width: min(100% - 1rem, 1120px);
    margin-top: .75rem;
  }

  .topbar {
    padding: .75rem .8rem;
  }

  .brand span {
    display: none;
  }

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

  .panel-head,
  .card-top {
    align-items: stretch;
    flex-direction: column;
  }

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

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

  .secondary,
  .danger,
  .ghost {
    width: 100%;
  }
}
