* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: #0d1117; color: #c9d1d9; }
.view { min-height: 100vh; }
.hidden { display: none !important; }
.muted { color: #8b949e; font-size: 13px; }
.err { color: #f85149; margin-top: 8px; font-size: 13px; min-height: 18px; }

/* ── Login ───────────────────────────────────────── */
#login-view { display: flex; align-items: center; justify-content: center; }
#login-view .card {
  background: #161b22; border: 1px solid #30363d; border-radius: 12px;
  padding: 32px; width: 360px; max-width: 92vw;
}
#login-view h1 { margin: 0 0 4px; font-size: 22px; }
#login-view p { margin: 0 0 20px; }
#login-form label { display: block; margin-bottom: 14px; font-size: 13px; color: #8b949e; }
#login-form input {
  display: block; width: 100%; margin-top: 4px;
  background: #0d1117; border: 1px solid #30363d; color: #c9d1d9;
  padding: 9px 11px; border-radius: 6px; font-size: 14px;
}
#login-form input:focus { outline: none; border-color: #1f6feb; }
#login-form button {
  width: 100%; padding: 10px; background: #238636; color: white;
  border: none; border-radius: 6px; font-weight: 600; font-size: 14px; cursor: pointer;
}
#login-form button:hover { background: #2ea043; }

/* ── App ───────────────────────────────────────── */
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px; border-bottom: 1px solid #21262d; background: #161b22;
}
header h1 { margin: 0; font-size: 17px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.panel { padding: 22px 24px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.panel-head h2 { margin: 0; font-size: 16px; }

.btn-ghost {
  background: transparent; color: #c9d1d9; border: 1px solid #30363d;
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.btn-ghost:hover { background: #21262d; }

.row {
  display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; align-items: center;
}
.row input {
  background: #0d1117; border: 1px solid #30363d; color: #c9d1d9;
  padding: 7px 10px; border-radius: 6px; font-size: 13px; flex: 1; min-width: 130px;
}
.row input:focus { outline: none; border-color: #1f6feb; }
.row button {
  padding: 7px 14px; background: #1f6feb; color: white; border: none;
  border-radius: 6px; font-weight: 600; font-size: 13px; cursor: pointer;
}
.row button:hover { background: #388bfd; }
.row .err { flex-basis: 100%; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 10px 8px; color: #8b949e; font-weight: 600;
  border-bottom: 1px solid #30363d; text-transform: uppercase; font-size: 11px;
}
tbody td { padding: 10px 8px; border-bottom: 1px solid #21262d; vertical-align: middle; }
tbody tr:hover { background: #161b22; }

.hwid-cell { font-family: "JetBrains Mono", Consolas, monospace; font-size: 11px; color: #8b949e; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.days-cell.expired { color: #f85149; font-weight: 600; }
.days-cell.low { color: #d29922; font-weight: 600; }
.days-cell.ok { color: #3fb950; }
.days-cell.unlimited { color: #8b949e; font-style: italic; }
.badge-admin { background: #1f6feb; color: white; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }

.act-group { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }

.days-input-group { display: inline-flex; gap: 0; border: 1px solid #30363d; border-radius: 4px; overflow: hidden; }
.days-input {
  width: 78px; padding: 4px 6px; font-size: 11px;
  background: #0d1117; color: #c9d1d9; border: none; outline: none;
  font-family: inherit;
}
.days-input::-webkit-inner-spin-button { opacity: 0.4; }
.days-input-group button[data-act="add-custom"] {
  padding: 4px 10px !important; font-size: 11px;
  background: #1f6feb !important; color: white !important; border: none !important;
  border-radius: 0 !important; cursor: pointer;
}
.days-input-group button[data-act="add-custom"]:hover { background: #388bfd !important; }
.act-group button {
  padding: 4px 8px; font-size: 11px; background: #21262d; color: #c9d1d9;
  border: 1px solid #30363d; border-radius: 4px; cursor: pointer;
}
.act-group button:hover { background: #30363d; }
.act-group button.danger { color: #f85149; border-color: #4a1f20; }
.act-group button.danger:hover { background: #4a1f20; }

.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: #238636; color: white; padding: 10px 16px; border-radius: 6px;
  font-size: 13px; box-shadow: 0 4px 20px rgba(0,0,0,0.4); z-index: 100;
}
.toast.err { background: #da3633; }
