/* ==========================================================================
   Orange Rent — License Admin: dark glassmorphism
   ========================================================================== */

:root {
  --orange: #FF7A00;
  --orange-soft: rgba(255, 122, 0, 0.16);
  --card: rgba(255, 255, 255, 0.055);
  --card-border: rgba(255, 255, 255, 0.10);
  --text: #f2f2f5;
  --dim: rgba(242, 242, 245, 0.55);
  --green: #4ade80;
  --blue: #60a5fa;
  --red: #f87171;
  --amber: #fbbf24;
  --gray: #9ca3af;
  --radius: 16px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background-color: #0a0a10;
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.accent { color: var(--orange); }
.mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0.02em; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.grow { flex: 1 1 220px; }

.copyable { cursor: pointer; border-bottom: 1px dotted rgba(255, 255, 255, 0.25); }
.copyable:hover { color: var(--orange); border-bottom-color: var(--orange); }

/* ------------------------------- glass ---------------------------------- */
.glass {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

/* ------------------------------- buttons -------------------------------- */
.btn {
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  padding: 8px 14px;
  font-size: 14px;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.13); }
.btn:disabled { opacity: 0.45; cursor: default; }

.btn.primary {
  background: linear-gradient(135deg, #ff8a1e, #ff6a00);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(255, 122, 0, 0.35);
}
.btn.primary:hover:not(:disabled) { background: linear-gradient(135deg, #ff9a3e, #ff7a10); }

.btn.ghost { background: transparent; }
.btn.small { padding: 5px 11px; font-size: 13px; }
/* table row-action buttons: clearly buttons, not faint text */
.btn.tiny {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.2);
}
.btn.tiny:hover:not(:disabled) { background: rgba(255, 255, 255, 0.18); }
.btn.wide { display: block; width: 100%; margin-top: 12px; }
.btn.danger {
  color: var(--red);
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
}
.btn.danger:hover:not(:disabled) { background: rgba(248, 113, 113, 0.16); }

/* ------------------------------- inputs --------------------------------- */
input, select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  min-width: 0;
}
input:focus, select:focus {
  border-color: rgba(255, 122, 0, 0.6);
  box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.15);
}
select option { background: #14141a; color: var(--text); }
input::placeholder { color: rgba(242, 242, 245, 0.35); }

.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--dim); }
.field input, .field select { font-size: 14px; color: var(--text); }
.small-field input { width: 84px; }

/* segmented toggle (mint kind) */
.seg {
  display: inline-flex;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
}
.seg-btn {
  padding: 8px 14px;
  background: transparent;
  border: 0;
  color: var(--dim);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}
.seg-btn.active { background: var(--orange-soft); color: var(--orange); font-weight: 600; }

/* ------------------------------- login ---------------------------------- */
.center-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: min(92vw, 380px);
  padding: 30px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-logo { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.login-sub { color: var(--dim); font-size: 13px; margin-top: -8px; margin-bottom: 6px; }
.error-line { color: var(--red); font-size: 13px; min-height: 1.2em; }

/* ------------------------------- tabs ------------------------------------ */
/* top bar: tabs (left, scrollable) + user info (right) share one compact row */
.tabbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px;
}
/* hamburger button (right of the tabs) */
.icon-btn {
  flex-shrink: 0;
  margin-left: auto;
  width: 40px; height: 40px;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.14); }
.icon-btn span { display: block; width: 18px; height: 2px; background: var(--text); border-radius: 2px; }

/* slide-in menu drawer */
.drawer-scrim {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 950;
  display: flex; justify-content: flex-end;
}
.drawer {
  width: min(82vw, 300px);
  height: 100%;
  padding: 24px 20px;
  background: rgba(20, 20, 28, 0.98);
  border-left: 1px solid var(--card-border);
  display: flex; flex-direction: column; gap: 14px;
  animation: drawerIn 0.2s ease;
}
@keyframes drawerIn { from { transform: translateX(24px); opacity: 0.4; } to { transform: translateX(0); opacity: 1; } }
.drawer-brand { font-size: 22px; font-weight: 700; }
.drawer-sub { color: var(--dim); font-size: 13px; margin-top: -10px; }
.drawer-account { margin-top: 8px; }
.drawer-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--dim); margin-bottom: 5px; }
.drawer-email { font-size: 14px; color: var(--text); word-break: break-all; }
.drawer .btn.wide { margin-top: auto; }
#user-email { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tabs {
  display: flex;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--dim);
  padding: 9px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--orange);
  background: var(--orange-soft);
  border-color: rgba(255, 122, 0, 0.3);
}

main { padding: 0 14px 40px; max-width: 1280px; margin: 0 auto; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 4px 2px 14px;
}
.panel-head h2 { margin: 0; font-size: 18px; }
.panel-head-right { display: flex; align-items: center; gap: 10px; }

/* ------------------------------- overview -------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.stat { padding: 16px 18px; }
.stat .v { font-size: 27px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .k {
  color: var(--dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 3px;
}
.v-green { color: var(--green); }
.v-blue { color: var(--blue); }
.v-red { color: var(--red); }
.v-amber { color: var(--amber); }
.v-gray { color: var(--gray); }
.v-orange { color: var(--orange); }

/* ------------------------------- toolbar / tables ------------------------ */
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.table-card { overflow: hidden; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; min-width: 880px; }
th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}
th.num { text-align: right; }
td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;      /* uniform rows even when a cell has a second dim line */
  font-size: 13.5px;
  line-height: 1.4;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.03); }

td.actions { white-space: nowrap; }
td.actions .btn + .btn { margin-left: 6px; }
td.note-cell { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); }

/* expiry countdown colors */
.exp { font-weight: 600; white-space: nowrap; }
.exp-life { color: var(--green); }
.exp-ok   { color: var(--dim); }
.exp-soon { color: #f6a935; }   /* amber: ≤ 7 days */
.exp-dead { color: var(--red); }

/* license codes: masked with dots when body.codes-hidden (screenshot-safe); copy still works */
.codes-hidden .code-val { -webkit-text-security: disc; letter-spacing: 0.12em; }

.cell-note { text-align: center; color: var(--dim); padding: 26px 12px !important; }
.cell-note.err { color: var(--red); }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 10px 12px;
  border-top: 1px solid var(--card-border);
}

/* ------------------------------- chips / badges -------------------------- */
.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.chip-green { color: var(--green); background: rgba(74, 222, 128, 0.10); border: 1px solid rgba(74, 222, 128, 0.35); }
.chip-blue  { color: var(--blue);  background: rgba(96, 165, 250, 0.10); border: 1px solid rgba(96, 165, 250, 0.35); }
.chip-red   { color: var(--red);   background: rgba(248, 113, 113, 0.10); border: 1px solid rgba(248, 113, 113, 0.35); }
.chip-amber { color: var(--amber); background: rgba(251, 191, 36, 0.10);  border: 1px solid rgba(251, 191, 36, 0.35); }
.chip-gray  { color: var(--gray);  background: rgba(156, 163, 175, 0.10); border: 1px solid rgba(156, 163, 175, 0.3); }

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 7px;
  font-size: 11.5px;
  font-family: var(--mono);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--card-border);
}
.badge-dim { color: var(--dim); background: rgba(255, 255, 255, 0.04); }
.badge-warn {
  color: var(--amber);
  background: rgba(251, 191, 36, 0.10);
  border-color: rgba(251, 191, 36, 0.4);
  cursor: help;
}

/* ------------------------------- mint card ------------------------------- */
.mint-card { padding: 16px 18px; margin-bottom: 14px; }
.mint-card h3 { margin: 0 0 12px; font-size: 15px; }
.mint-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.mint-form .btn.primary { margin-bottom: 1px; }

.code-list {
  font-size: 16px;
  line-height: 1.9;
  max-height: 46vh;
  overflow-y: auto;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--card-border);
  border-radius: 12px;
}

/* ------------------------------- audit ----------------------------------- */
.audit-item {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: baseline;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 8px;
  font-size: 13.5px;
}
.audit-time { color: var(--dim); font-size: 12px; min-width: 62px; }
.audit-detail { font-size: 12px; overflow-wrap: anywhere; flex-basis: 100%; }

.ev {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--mono);
}
.ev-green { color: var(--green); background: rgba(74, 222, 128, 0.10); border: 1px solid rgba(74, 222, 128, 0.3); }
.ev-red   { color: var(--red);   background: rgba(248, 113, 113, 0.10); border: 1px solid rgba(248, 113, 113, 0.3); }
.ev-amber { color: var(--amber); background: rgba(251, 191, 36, 0.10);  border: 1px solid rgba(251, 191, 36, 0.3); }
.ev-gray  { color: var(--gray);  background: rgba(156, 163, 175, 0.08); border: 1px solid rgba(156, 163, 175, 0.25); }
.ev-dim   { color: var(--dim);   background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); }

#audit-list .cell-note { padding: 26px 12px; }

/* ------------------------------- modal ----------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 900;
}
.modal-card {
  width: min(94vw, 460px);
  max-height: 82vh;
  overflow-y: auto;
  padding: 18px 20px 20px;
  background: rgba(20, 20, 28, 0.92);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.modal-head h3 { margin: 0; font-size: 16px; }

/* glass confirm / prompt dialogs */
.dialog-msg { margin: 0 0 14px; font-size: 14px; line-height: 1.5; color: var(--text); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ------------------------------- toasts ---------------------------------- */
#toasts {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  width: min(92vw, 440px);
  pointer-events: none;
}
.toast {
  padding: 11px 15px;
  border-radius: 12px;
  font-size: 14px;
  background: rgba(20, 20, 28, 0.94);
  border: 1px solid var(--card-border);
  border-left: 3px solid var(--green);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  animation: toast-in 0.22s ease-out;
  overflow-wrap: anywhere;
}
.toast.err { border-left-color: var(--red); }
.toast.fade { opacity: 0; transition: opacity 0.4s; }

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

/* ------------------------------- phone ----------------------------------- */
@media (max-width: 640px) {
  body { font-size: 14px; }
  /* >=16px stops mobile browsers (iOS Safari) from auto-zooming on input focus */
  input, select, textarea, .field input, .field select { font-size: 16px; }
  .tabbar { margin: 10px; }
  /* narrow row: keep Sign out visible, drop the long email to save space */
  #user-email { display: none; }
  main { padding: 0 10px 34px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .stat { padding: 13px 14px; }
  .stat .v { font-size: 23px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .grow { flex-basis: auto; }
  .mint-form { align-items: stretch; flex-direction: column; }
  .mint-form .small-field input { width: 100%; }
  .btn { padding: 10px 14px; }        /* comfortable touch targets */
  .btn.small { padding: 7px 12px; }
  .btn.tiny { padding: 5px 10px; }
  .audit-time { min-width: 100%; }
}
