:root {
  --sidebar: #121925;
  --sidebar-2: #1b2535;
  --canvas: #f3f6fa;
  --surface: #ffffff;
  --line: #dce2ea;
  --line-soft: #edf0f4;
  --text: #182033;
  --muted: #718096;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --teal: #14b8a6;
  --danger: #ef4444;
  --warning: #f59e0b;
  --blue: #4f7cff;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.shell { min-height: 100vh; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: 30px; letter-spacing: -.035em; }
h2 { margin-bottom: 7px; font-size: 21px; letter-spacing: -.02em; }
.eyebrow { margin-bottom: 8px; color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.muted { margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.wordmark { color: #fff; font-size: 36px; font-weight: 900; letter-spacing: .015em; }
.brand-subtitle { margin: 2px 0 0; color: #d6deeb; font-size: 14px; font-weight: 650; }

/* Login */
.login-layout { display: grid; grid-template-columns: 340px 1fr; min-height: 100vh; }
.login-brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 46px 42px 34px;
  color: #fff;
  background: var(--sidebar);
}
.brand-message h1 { font-size: 37px; line-height: 1.2; }
.brand-message > p:last-child { max-width: 240px; color: #94a1b5; font-size: 14px; line-height: 1.75; }
.brand-message .eyebrow { color: #5f84ff; }
.brand-foot { margin: 0; color: #647086; font-size: 10px; letter-spacing: .05em; }
.login-main { display: grid; place-items: center; padding: 36px; }
.login-card {
  width: min(430px, 100%);
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(37, 48, 72, .1);
}
.stack { display: grid; gap: 17px; margin-top: 28px; }
label { display: grid; gap: 8px; color: #4b5565; font-size: 12px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid #cdd4df;
  border-radius: 8px;
  outline: none;
  color: var(--text);
  background: #fff;
}
input, select { height: 42px; padding: 0 12px; }
textarea { min-height: 176px; padding: 14px; resize: vertical; font: 13px/1.7 Consolas, monospace; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .11); }
button {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 750;
}
.primary { color: #fff; background: var(--primary); }
.primary:hover { background: var(--primary-hover); }
.ghost { color: #4b5565; border-color: var(--line); background: #fff; }
.ghost:hover { border-color: #b8c1ce; background: #f8fafc; }
.danger { color: var(--danger); }
.error { min-height: 20px; margin: 0; color: var(--danger); font-size: 12px; }

/* Application */
.app-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 30px 20px 22px;
  background: var(--sidebar);
}
.side-nav { margin-top: 42px; }
.nav-label { margin: 0 10px 10px; color: #6f7c91; font-size: 10px; letter-spacing: .08em; }
.nav-item {
  display: block;
  margin: 4px 0;
  padding: 12px 13px;
  border-radius: 7px;
  color: #b8c3d4;
  font-size: 13px;
  text-decoration: none;
}
.nav-item:hover { color: #fff; background: #253047; }
.nav-item.active { color: #fff; background: var(--primary); }
.sidebar-status {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: auto;
  padding: 13px;
  border: 1px solid #2d3950;
  border-radius: 9px;
  background: #1c2636;
}
.status-dot { width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: var(--teal); }
.sidebar-status strong { display: block; color: #dce4ef; font-size: 11px; }
.sidebar-status small { display: block; margin-top: 4px; color: #7f8da2; font-size: 10px; }

.workspace { min-width: 0; padding: 28px 30px 60px; }
.topbar, .section-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.topbar { margin-bottom: 24px; }
.top-actions, .filters { display: flex; align-items: center; gap: 9px; }
.chip {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #5d6878;
  background: #fff;
  font-size: 12px;
}
.overview {
  display: grid;
  grid-template-columns: 1.25fr repeat(5, 1fr);
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.overview-title, .overview article { padding: 16px 18px; border-right: 1px solid var(--line-soft); }
.overview article:last-child { border-right: 0; }
.overview-title span { display: block; font-size: 13px; font-weight: 750; }
.overview-title small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.overview article span { display: block; color: var(--muted); font-size: 10px; }
.overview article strong { display: block; margin-top: 5px; font-size: 21px; letter-spacing: -.03em; }
.overview article:nth-child(4) strong { color: var(--teal); }
.overview article:nth-child(6) strong { color: var(--danger); }

.panel {
  margin-top: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.issue-panel { display: grid; grid-template-columns: minmax(225px, .7fr) minmax(560px, 1.4fr); align-items: end; gap: 30px; }
.batch-form { display: flex; align-items: end; gap: 11px; }
.batch-form label { width: 135px; }
.batch-form .grow { flex: 1; width: auto; }
.created-panel { border-color: rgba(79, 70, 229, .36); box-shadow: 0 0 0 3px rgba(79, 70, 229, .04); }
.filters input { width: 250px; }
.filters select { width: 128px; }
.table-wrap { margin-top: 18px; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; min-width: 860px; border-collapse: collapse; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { color: #697586; background: #f8fafc; font-size: 10px; font-weight: 800; letter-spacing: .04em; }
td { color: #344054; font-size: 12px; }
.mono { font-family: Consolas, monospace; }
.device { max-width: 115px; overflow: hidden; text-overflow: ellipsis; }
.status { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 10px; font-weight: 800; }
.status.active { color: #0b8f80; background: rgba(20, 184, 166, .1); }
.status.unactivated { color: #375fe0; background: rgba(79, 124, 255, .1); }
.status.expired { color: #b77707; background: rgba(245, 158, 11, .1); }
.status.disabled { color: #d3334b; background: rgba(239, 68, 68, .1); }
.row-actions { display: flex; gap: 6px; }
.row-actions button { min-height: 30px; padding: 0 9px; border-color: var(--line); color: #4b5565; background: #fff; font-size: 10px; }
.row-actions button:hover { border-color: var(--primary); color: var(--primary); }
.actions-col { min-width: 176px; }
.empty { padding: 28px 0 8px; text-align: center; color: var(--muted); }
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 420px;
  padding: 13px 17px;
  border: 1px solid #303b50;
  border-radius: 9px;
  color: #edf2f8;
  background: #172131;
  box-shadow: 0 18px 50px rgba(18, 25, 37, .22);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1080px) {
  .app-layout { grid-template-columns: 210px minmax(0, 1fr); }
  .overview { grid-template-columns: repeat(3, 1fr); }
  .overview-title { grid-column: 1 / -1; border-bottom: 1px solid var(--line-soft); }
  .issue-panel { grid-template-columns: 1fr; }
  .batch-form { flex-wrap: wrap; }
  .batch-form label, .batch-form .grow { flex: 1 1 180px; width: auto; }
}
@media (max-width: 760px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-brand { min-height: 250px; padding: 28px; }
  .brand-message { margin-top: 44px; }
  .brand-message h1 { font-size: 30px; }
  .brand-foot { display: none; }
  .login-main { padding: 22px; }
  .app-layout { display: block; }
  .sidebar { position: static; height: auto; padding: 20px; }
  .side-nav { display: flex; gap: 7px; margin-top: 20px; overflow-x: auto; }
  .nav-label, .sidebar-status { display: none; }
  .nav-item { white-space: nowrap; }
  .workspace { padding: 22px 14px 50px; }
  .topbar, .section-head { align-items: flex-start; flex-direction: column; }
  .top-actions, .filters { width: 100%; flex-wrap: wrap; }
  .filters input, .filters select { flex: 1 1 180px; width: auto; }
  .overview { grid-template-columns: repeat(2, 1fr); }
}
