:root {
  --bg: #07090d;
  --bg-2: #0b0e14;
  --panel: #10141c;
  --panel-2: #141924;
  --panel-3: #1a2030;
  --border: rgba(148, 163, 184, 0.11);
  --border-strong: rgba(148, 163, 184, 0.2);
  --text: #e7edf6;
  --muted: #8b97ab;
  --muted-2: #66718a;
  --accent: #2dd4bf;
  --accent-deep: #14b8a6;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #fb7185;
  --blue: #60a5fa;
  --radius: 16px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text);
  background:
    radial-gradient(1100px 620px at 6% -12%, rgba(45, 212, 191, 0.06), transparent 58%),
    radial-gradient(900px 620px at 105% -5%, rgba(14, 165, 233, 0.05), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font-family: inherit;
}

::selection {
  background: rgba(45, 212, 191, 0.25);
}

:focus-visible {
  outline: 2px solid rgba(45, 212, 191, 0.55);
  outline-offset: 2px;
}

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: #253044 transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-thumb {
  background: #253044;
  border-radius: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.icon svg {
  width: 17px;
  height: 17px;
}

/* ---------- Buttons & fields ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.005em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, filter 0.15s ease, transform 0.06s ease;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn .icon svg {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: linear-gradient(135deg, #2dd4bf, #14b8a6);
  border-color: rgba(45, 212, 191, 0.45);
  color: #032520;
  box-shadow: 0 8px 22px rgba(20, 184, 166, 0.16);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.07);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--panel-2);
  color: var(--text);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
}

.btn-soft-success {
  background: rgba(52, 211, 153, 0.07);
  border-color: rgba(52, 211, 153, 0.2);
  color: #5eead4;
}

.btn-soft-success:hover:not(:disabled) {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.32);
}

.btn-soft-danger {
  background: rgba(251, 113, 133, 0.06);
  border-color: rgba(251, 113, 133, 0.17);
  color: #fda4af;
}

.btn-soft-danger:hover:not(:disabled) {
  background: rgba(251, 113, 133, 0.11);
  border-color: rgba(251, 113, 133, 0.3);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  background: var(--panel-2);
  border-color: var(--border);
  color: var(--text);
}

.icon-btn.danger:hover {
  background: rgba(251, 113, 133, 0.08);
  border-color: rgba(251, 113, 133, 0.2);
  color: var(--red);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #aab6c8;
}

.field-label em {
  font-style: normal;
  font-weight: 500;
  font-size: 10.5px;
  color: var(--muted-2);
}

.field input,
.field select {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #0a0e15;
  color: var(--text);
  font-size: 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder {
  color: #5b6577;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: rgba(45, 212, 191, 0.55);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.1);
}

.field input[readonly] {
  color: var(--muted);
  background: #080b10;
  cursor: not-allowed;
}

.field .mono {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.hint {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted-2);
}

.mobile-only {
  display: none;
}

/* ---------- Boot ---------- */

.boot {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
}

.boot p {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(148, 163, 184, 0.16);
  border-top-color: var(--accent);
  animation: spin 0.85s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Layout ---------- */

.app {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 20px 14px 16px;
  background: linear-gradient(180deg, rgba(16, 20, 28, 0.72), rgba(8, 11, 16, 0.9));
  border-right: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 20px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  color: #04231f;
  background: linear-gradient(135deg, #5eead4, #14b8a6 55%, #0e7490);
  border: 1px solid rgba(153, 246, 228, 0.35);
  box-shadow: 0 8px 20px rgba(20, 184, 166, 0.18);
}

.brand-mark svg {
  width: 20px;
  height: 20px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.brand-text strong {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text small {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav-item .icon svg {
  width: 17px;
  height: 17px;
}

.nav-item:hover {
  background: rgba(148, 163, 184, 0.05);
  color: var(--text);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(45, 212, 191, 0.12), rgba(45, 212, 191, 0.03));
  border-color: rgba(45, 212, 191, 0.14);
  color: #d9fff9;
}

.nav-item.active .icon {
  color: var(--accent);
}

.nav-badge {
  margin-left: auto;
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.22);
  color: #fcd34d;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.side-status {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  font-size: 11px;
  color: var(--muted-2);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.1);
}

.main {
  width: 100%;
  max-width: 1480px;
  padding: 26px 30px 48px;
  margin: 0 auto;
  min-width: 0;
}

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.topbar-title h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.025em;
}

.topbar-title p {
  margin: 5px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.key-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  max-width: min(390px, 44vw);
  padding: 5px 5px 5px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(16, 20, 28, 0.75);
}

.key-icon {
  display: inline-flex;
  color: var(--accent);
}

.key-icon svg {
  width: 16px;
  height: 16px;
}

.key-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.key-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted-2);
}

#appKey {
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: #aebdd2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 230px;
}

.key-pill .icon-btn {
  width: 30px;
  height: 30px;
}

/* ---------- Stats ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.stat {
  position: relative;
  overflow: hidden;
  padding: 17px 18px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--panel-2), var(--panel) 65%);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.stat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18px;
  width: 30px;
  height: 2px;
  border-radius: 2px;
  background: var(--muted-2);
}

.stat-active::before {
  background: var(--green);
}

.stat-pending::before {
  background: var(--amber);
}

.stat-blocked::before {
  background: var(--red);
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.stat-active .stat-label::before,
.stat-pending .stat-label::before,
.stat-blocked .stat-label::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.stat-active .stat-label {
  color: #6ee7b7;
}

.stat-pending .stat-label {
  color: #fcd34d;
}

.stat-blocked .stat-label {
  color: #fda4af;
}

.stat strong {
  display: block;
  margin: 8px 0 2px;
  font-size: 29px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat-sub {
  font-size: 11.5px;
  color: var(--muted-2);
}

/* ---------- Cards ---------- */

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

.card + .card {
  margin-top: 16px;
}

.card-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.card-head.with-action {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.card-head h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-head p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.filter-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0a0d13;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.filter-tab:hover {
  color: var(--text);
}

.filter-tab.active {
  background: var(--panel-3);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.filter-tab .count {
  min-width: 17px;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.1);
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.filter-tab.active .count {
  background: rgba(45, 212, 191, 0.12);
  color: #5eead4;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #0a0d13;
  color: var(--muted-2);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search:focus-within {
  border-color: rgba(45, 212, 191, 0.45);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.08);
}

.search .icon svg {
  width: 15px;
  height: 15px;
}

.search input {
  width: 195px;
  max-width: 40vw;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
}

.search input::placeholder {
  color: #5b6577;
}

.search input::-webkit-search-cancel-button {
  filter: invert(0.6);
}

/* ---------- Client table ---------- */

.table-wrap {
  overflow-x: auto;
}

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

.clients-table th {
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.02);
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}

.clients-table td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 13px;
}

.clients-table tbody tr:last-child td {
  border-bottom: 0;
}

.clients-table tbody tr {
  transition: background 0.12s ease;
}

.clients-table tbody tr:hover {
  background: rgba(148, 163, 184, 0.025);
}

.clients-table th:nth-child(1) {
  width: 23%;
}

.clients-table th:nth-child(2) {
  width: 25%;
}

.clients-table th:nth-child(3) {
  width: 13%;
}

.th-actions,
.td-actions {
  text-align: right !important;
}

.client-id {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 160px;
}

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(94, 234, 212, 0.16);
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.14), rgba(14, 165, 233, 0.1));
  color: #a5f3fc;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.client-info {
  min-width: 0;
}

.client-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

.client-note {
  max-width: 220px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--muted-2);
}

.hwid-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  padding: 3px 3px 3px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0a0e15;
}

.hwid {
  display: block;
  max-width: 175px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: #96a7c0;
}

.hwid-chip .icon-btn {
  width: 23px;
  height: 23px;
  border-radius: 6px;
  color: var(--muted-2);
}

.hwid-chip .icon-btn:hover {
  color: var(--text);
}

.hwid-chip .icon svg {
  width: 12px;
  height: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.badge-active {
  color: #4ade80;
  background: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.18);
}

.badge-pending {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.07);
  border-color: rgba(251, 191, 36, 0.17);
}

.badge-blocked {
  color: #fb7185;
  background: rgba(251, 113, 133, 0.07);
  border-color: rgba(251, 113, 133, 0.17);
}

.last-seen {
  font-size: 12px;
  line-height: 1.45;
  white-space: nowrap;
}

.online-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
  font-weight: 600;
}

.online-line .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.11);
}

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

.seen-meta {
  margin-top: 1px;
  font-size: 10.5px;
  color: var(--muted-2);
}

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

/* ---------- Empty states ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 52px 24px;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel-2);
  color: var(--muted);
}

.empty-icon svg {
  width: 24px;
  height: 24px;
}

.empty h3 {
  margin: 0 0 5px;
  font-size: 15px;
  font-weight: 600;
}

.empty p {
  max-width: 390px;
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

.empty .btn {
  margin-top: 16px;
}

/* ---------- Files ---------- */

.upload-card .card-head {
  border-bottom: 1px solid var(--border);
}

.upload-card form {
  padding: 18px 20px 20px;
}

.upload-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 255px;
  gap: 16px;
}

.dropzone {
  display: flex;
  align-items: center;
  min-height: 126px;
  padding: 20px;
  border: 1.5px dashed rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  background: rgba(148, 163, 184, 0.02);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: rgba(45, 212, 191, 0.45);
  background: rgba(45, 212, 191, 0.035);
  outline: none;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(45, 212, 191, 0.07);
}

.dropzone-prompt,
.file-chosen {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.drop-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(45, 212, 191, 0.16);
  border-radius: 12px;
  background: rgba(45, 212, 191, 0.07);
  color: var(--accent);
}

.drop-icon svg {
  width: 21px;
  height: 21px;
}

.drop-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.drop-text strong {
  font-size: 13px;
  font-weight: 600;
}

.drop-text small {
  font-size: 11px;
  color: var(--muted-2);
}

.file-chosen-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.file-chosen-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}

.file-chosen-info small {
  font-size: 11px;
  color: var(--muted-2);
}

.file-chosen-hint {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}

.upload-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.upload-side .btn {
  margin-top: 2px;
}

.file-list {
  display: flex;
  flex-direction: column;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.file-row:last-child {
  border-bottom: 0;
}

.file-tile {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(45, 212, 191, 0.15);
  border-radius: 10px;
  background: rgba(45, 212, 191, 0.06);
  color: #5eead4;
}

.file-tile svg {
  width: 19px;
  height: 19px;
}

.file-main {
  flex: 1;
  min-width: 0;
}

.file-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.file-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}

.version-chip {
  padding: 2px 6px;
  border: 1px solid rgba(96, 165, 250, 0.18);
  border-radius: 5px;
  background: rgba(96, 165, 250, 0.08);
  color: #93c5fd;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.file-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted-2);
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.file-downloads {
  margin-right: 6px;
  font-size: 11px;
  color: var(--muted-2);
  white-space: nowrap;
}

.share-card .card-head {
  border-bottom: 1px solid var(--border);
}

.share-body {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 16px 20px 0;
}

.share-field {
  flex: 1;
  min-width: 0;
}

.share-actions {
  display: flex;
  gap: 6px;
}

.share-card .hint {
  padding: 10px 20px 16px;
}

@media (max-width: 720px) {
  .share-body {
    flex-direction: column;
    align-items: stretch;
  }

  .share-actions .btn {
    flex: 1;
  }
}

/* ---------- Activity ---------- */

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
  border-bottom: 0;
}

.activity-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(148, 163, 184, 0.06);
  color: var(--muted);
}

.activity-icon svg {
  width: 15px;
  height: 15px;
}

.activity-icon.green {
  border-color: rgba(52, 211, 153, 0.16);
  background: rgba(52, 211, 153, 0.07);
  color: var(--green);
}

.activity-icon.amber {
  border-color: rgba(251, 191, 36, 0.16);
  background: rgba(251, 191, 36, 0.06);
  color: var(--amber);
}

.activity-icon.red {
  border-color: rgba(251, 113, 133, 0.16);
  background: rgba(251, 113, 133, 0.06);
  color: var(--red);
}

.activity-icon.blue {
  border-color: rgba(96, 165, 250, 0.16);
  background: rgba(96, 165, 250, 0.06);
  color: var(--blue);
}

.activity-main {
  flex: 1;
  min-width: 0;
}

.activity-msg {
  font-size: 12.5px;
  line-height: 1.45;
  color: #cfd8e5;
  word-break: break-word;
}

.activity-time {
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--muted-2);
}

/* ---------- Dialog ---------- */

dialog#clientDialog {
  width: min(470px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
}

dialog::backdrop {
  background: rgba(2, 4, 8, 0.7);
  backdrop-filter: blur(4px);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.dialog-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.dialog-head p {
  margin: 4px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}

.dialog-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
}

.dialog-error {
  padding: 9px 11px;
  border: 1px solid rgba(251, 113, 133, 0.2);
  border-radius: 9px;
  background: rgba(251, 113, 133, 0.08);
  color: #fda4af;
  font-size: 12px;
  line-height: 1.45;
}

.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.015);
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 70;
  max-width: min(390px, calc(100vw - 32px));
  padding: 12px 15px;
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: 11px;
  background: #111722;
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.45;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  border-left-color: var(--green);
}

.toast.error {
  border-left-color: var(--red);
}

/* ---------- Login ---------- */

.login-body {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  overflow: hidden;
  background:
    radial-gradient(1100px 720px at 12% -12%, rgba(45, 212, 191, 0.08), transparent 58%),
    radial-gradient(900px 640px at 108% 112%, rgba(14, 165, 233, 0.08), transparent 55%),
    #07090d;
}

.login-body::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 42%, rgba(0, 0, 0, 0.55), transparent 72%);
  pointer-events: none;
}

.login-glow {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.28;
  pointer-events: none;
}

.login-glow-a {
  top: -170px;
  left: 10%;
  background: #0d9488;
}

.login-glow-b {
  right: 4%;
  bottom: -190px;
  background: #0c4a6e;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  padding: 32px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 20px;
  background: rgba(16, 20, 28, 0.84);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(14px);
}

.login-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.brand-mark-lg {
  width: 52px;
  height: 52px;
  border-radius: 15px;
}

.brand-mark-lg svg {
  width: 26px;
  height: 26px;
}

.login-card h1 {
  margin: 0;
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-align: center;
}

.login-sub {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 24px;
}

.password-wrap {
  position: relative;
  display: block;
}

.password-wrap input {
  padding-right: 64px;
}

.pw-toggle {
  position: absolute;
  top: 5px;
  right: 5px;
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}

.pw-toggle:hover {
  color: var(--text);
}

.login-submit {
  height: 42px;
  margin-top: 2px;
}

.form-error {
  margin: 0;
  padding: 9px 11px;
  border: 1px solid rgba(251, 113, 133, 0.18);
  border-radius: 9px;
  background: rgba(251, 113, 133, 0.08);
  color: #fda4af;
  font-size: 12px;
  line-height: 1.4;
}

.login-foot {
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--muted-2);
  font-size: 10.5px;
  line-height: 1.5;
  text-align: center;
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .upload-side {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 10px;
  }

  .upload-side .hint {
    grid-column: 1 / -1;
  }

  .upload-side .btn {
    height: 38px;
  }
}

@media (max-width: 960px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    height: auto;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    background: rgba(10, 13, 19, 0.92);
  }

  .brand {
    padding: 0;
  }

  .brand-text small {
    display: none;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .brand-mark svg {
    width: 18px;
    height: 18px;
  }

  .nav {
    flex: 1;
    flex-direction: row;
    gap: 2px;
    overflow-x: auto;
  }

  .nav-item {
    width: auto;
    height: 36px;
    padding: 0 10px;
    white-space: nowrap;
  }

  .sidebar-foot {
    display: none;
  }

  .mobile-only {
    display: inline-flex;
  }

  .main {
    padding: 20px 18px 40px;
  }

  .key-pill {
    max-width: 46vw;
  }

  .topbar {
    align-items: center;
  }
}

@media (max-width: 760px) {
  .topbar {
    flex-wrap: wrap;
    margin-bottom: 18px;
  }

  .topbar-actions {
    width: 100%;
  }

  .key-pill {
    flex: 1;
    max-width: none;
  }

  #appKey {
    max-width: 100%;
  }

  .key-meta {
    flex: 1;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .search {
    flex: 1;
  }

  .search input {
    width: 100%;
    max-width: none;
  }

  .clients-table thead {
    display: none;
  }

  .clients-table,
  .clients-table tbody,
  .clients-table tr,
  .clients-table td {
    display: block;
    width: 100%;
  }

  .clients-table tbody {
    padding: 10px;
  }

  .clients-table tbody tr {
    margin-bottom: 9px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(148, 163, 184, 0.015);
    overflow: hidden;
  }

  .clients-table tbody tr:last-child {
    margin-bottom: 0;
  }

  .clients-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 13px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.06);
  }

  .clients-table td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-2);
  }

  .clients-table td:first-child {
    padding-top: 13px;
    border-bottom: 0;
  }

  .clients-table td:first-child::before {
    display: none;
  }

  .clients-table td:last-child {
    padding-bottom: 13px;
  }

  .clients-table .td-actions {
    justify-content: flex-end;
  }

  .td-actions::before {
    display: none;
  }

  .client-id {
    min-width: 0;
  }

  .hwid-chip {
    max-width: 62vw;
  }

  .hwid {
    max-width: 46vw;
  }

  .file-row {
    flex-wrap: wrap;
    padding: 14px 16px;
  }

  .file-main {
    flex: 1;
    min-width: 160px;
  }

  .file-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 2px;
  }

  .file-downloads {
    margin-right: auto;
  }

  .upload-card form {
    padding: 15px 16px 16px;
  }

  .toolbar {
    padding: 12px 14px;
  }

  .card-head {
    padding: 16px;
  }

  .activity-item {
    padding: 12px 16px;
  }

  .empty {
    padding: 44px 20px;
  }
}

@media (max-width: 540px) {
  .main {
    padding: 16px 12px 36px;
  }

  .stats-grid {
    gap: 9px;
  }

  .stat {
    padding: 14px 14px 13px;
  }

  .stat strong {
    font-size: 25px;
  }

  .topbar-title h1 {
    font-size: 22px;
  }

  .key-icon,
  .key-label {
    display: none;
  }

  .key-pill {
    padding-left: 10px;
  }

  .filter-tabs {
    width: 100%;
    overflow-x: auto;
  }

  .filter-tab {
    flex: 1;
    justify-content: center;
    padding: 0 8px;
  }

  .filter-tab .count {
    display: none;
  }

  .toolbar-right {
    flex-wrap: wrap;
  }

  .search {
    width: 100%;
    flex: 1 1 100%;
  }

  #addClientBtn {
    width: 100%;
  }

  .upload-side {
    display: flex;
  }

  .file-actions .btn-sm span:not(.icon) {
    display: none;
  }

  .file-actions .btn-sm {
    width: 32px;
    padding: 0;
  }

  .file-actions .btn-sm.link-copy {
    width: auto;
    padding: 0 10px;
  }

  .file-actions .btn-sm.link-copy span:not(.icon) {
    display: inline;
  }

  .login-card {
    padding: 26px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
