/* ============ Login page ============ */
.auth-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--color-bg);
}
.auth-container {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.auth-header {
  text-align: center;
  margin-bottom: 28px;
}
.auth-wordmark {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.022em;
  color: var(--color-text);
  line-height: 1.15;
}
.auth-subtitle {
  margin-top: 8px;
  font-size: 16px;
  color: var(--color-text-light);
}
.auth-back {
  margin-top: 14px;
  text-align: center;
  font-size: 13px;
}
.auth-back a {
  color: var(--color-text-secondary);
  text-decoration: none;
}
.auth-back a:hover { color: var(--color-accent); }

.auth-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-form.is-error .auth-field-group {
  animation: shake 360ms var(--ease);
}
.auth-field-group {
  background: var(--color-surface);
  border-radius: var(--radius-control);
  box-shadow:
    inset 0 0 0 1px var(--color-input-border),
    0 1px 2px rgba(0,0,0,0.03);
  overflow: hidden;
  transition: box-shadow var(--dur-base) var(--ease);
}
.auth-field-group:has(input:focus) {
  box-shadow:
    inset 0 0 0 1px var(--color-accent),
    0 0 0 3px rgba(0,102,204,0.18);
}
.auth-field input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  font-size: 14px;
  background: transparent;
  border: 0;
}
.auth-field input::placeholder { color: var(--color-text-light); }
.auth-divider {
  height: 1px;
  background: var(--color-divider-soft);
  margin-left: 14px;
}
.auth-options {
  display: flex;
  justify-content: flex-start;
  padding: 0 2px;
}
.auth-error {
  font-size: 12.5px;
  color: var(--color-danger);
  padding: 0 2px;
  font-weight: 500;
}

.auth-footer {
  position: fixed;
  bottom: 18px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--color-text-light);
}
.auth-footer a {
  color: var(--color-text-light);
  text-decoration: none;
}
.auth-footer a:hover { color: var(--color-accent); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* ============ Console body ============ */
.console-body { background: var(--color-bg); }

/* ============ Module grid (home) ============ */
.module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-5);
}
.module-card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--color-text);
  transition: transform var(--dur-base) var(--ease),
              box-shadow var(--dur-base) var(--ease);
  min-height: 96px;
}
.module-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-hover);
  color: var(--color-text);
}
.module-card-soon {
  background: var(--color-sidebar);
  box-shadow: inset 0 0 0 1px var(--color-divider-soft);
}
.module-card-soon:hover {
  background: var(--color-sidebar-strong);
  box-shadow: inset 0 0 0 1px var(--color-divider);
  transform: none;
}
.module-card-soon .module-title { color: var(--color-text-secondary); }
.module-card-soon .module-desc  { color: var(--color-text-muted); }

.module-icon {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: var(--color-accent-tint);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.module-card-soon .module-icon {
  background: rgba(0,0,0,0.05);
  color: var(--color-text-muted);
}
.card-icon { width: 22px; height: 22px; }
.module-title { font-size: 15.5px; font-weight: 600; letter-spacing: -0.012em; }
.module-desc { margin-top: 3px; font-size: 12.5px; color: var(--color-text-muted); }

/* ============ Proxy: usage block ============ */
.usage-stats {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--color-text-muted);
}
.usage-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-light);
}
.usage-used {
  font-size: 24px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.018em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.usage-divider { color: var(--color-text-light); }
.usage-total {
  font-size: 13.5px;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

/* ============ Proxy: reset row ============ */
.reset-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.reset-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--color-accent-tint);
  color: var(--color-accent);
  flex-shrink: 0;
}
.reset-icon { width: 20px; height: 20px; }
.reset-text-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.reset-label {
  font-size: 11.5px;
  color: var(--color-text-light);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}
.reset-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.012em;
}

/* ============ Proxy: tips list ============ */
.tips-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tips-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--color-text-secondary);
  letter-spacing: -0.003em;
}
.tips-bullet {
  display: block;
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  margin-top: 10px;
  border-radius: 50%;
  background: var(--color-text-light);
}
.tips-warn { color: var(--color-text); font-weight: 500; }
.tips-warn .tips-bullet {
  background: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(215, 0, 21, 0.12);
}
.tips-text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}
.tips-text a {
  color: var(--color-accent);
  text-decoration: none;
  word-break: break-all;
}
.tips-text a:hover { text-decoration: underline; }
.tips-closing {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--color-divider-soft);
  font-size: 12.5px;
  color: var(--color-text-muted);
  font-style: normal;
  text-align: right;
  letter-spacing: -0.003em;
}

/* ============ Proxy (admin) — file slots ============ */
.file-info {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--color-bg);
  border-radius: 8px;
  margin-bottom: 14px;
}
.file-icon {
  width: 28px;
  height: 28px;
  color: var(--color-text-muted);
}
.file-meta { min-width: 0; flex: 1; }
.file-name { font-size: 13.5px; font-weight: 500; }
.file-name-empty { color: var(--color-text-light); font-weight: 400; }
.file-sub { font-size: 12px; color: var(--color-text-light); margin-top: 2px; }
.upload-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.file-label {
  position: relative;
  overflow: hidden;
}
.file-label input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* ============ Proxy (user) ============ */
.copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.copy-row .input { flex: 1; min-width: 0; font-size: 12.5px; }
.copy-btn { min-width: 92px; transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.copy-btn.is-copied {
  background: var(--color-flash-success-bg);
  color: var(--color-flash-success-fg);
  box-shadow: inset 0 0 0 1px rgba(31,94,44,0.22);
}
.empty-state {
  font-size: 13.5px;
  color: var(--color-text-light);
  padding: 12px 0;
}

.download-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4);
}
.download-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  background: var(--color-bg);
  border-radius: 10px;
}
.os-icon { width: 32px; height: 32px; color: var(--color-text); }
.download-title { font-size: 14px; font-weight: 600; }
.download-sub { font-size: 12.5px; color: var(--color-text-light); margin-top: 2px; }
.download-card .btn { align-self: flex-start; }

/* ============ Users table ============ */
.user-table {
  width: 100%;
  font-size: 13.5px;
}
.user-table thead th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--color-text-light);
  padding: 12px 14px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-divider-soft);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.user-table tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--color-divider-soft);
  vertical-align: middle;
}
.user-table tbody td.cell-meta { white-space: nowrap; }
.user-table tbody tr:last-child td { border-bottom: 0; }
.user-table tbody tr:hover td { background: var(--color-hover); }
.cell-username { font-weight: 500; letter-spacing: -0.005em; }
.cell-meta { color: var(--color-text-muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.col-actions { text-align: right; white-space: nowrap; }
.col-actions .btn-text + .btn-text { margin-left: 2px; }
.protected-note {
  font-size: 12px;
  color: var(--color-text-light);
  font-style: normal;
}
.login-time { display: inline-flex; flex-direction: column; gap: 1px; line-height: 1.3; }
.login-time strong { font-weight: 500; color: var(--color-text-secondary); font-size: 12.5px; }
.login-time-abs { font-size: 11px; color: var(--color-text-light); font-variant-numeric: tabular-nums; }
.never { color: var(--color-text-light); font-style: normal; }

.presence {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}
.presence-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.presence-online  {
  color: var(--color-flash-success-fg, #1F5E2C);
}
.presence-online .presence-dot {
  box-shadow: 0 0 0 3px rgba(31, 94, 44, 0.16);
}
.presence-offline {
  color: var(--color-text-muted, #9b9b9b);
  font-weight: 400;
}

/* ============ Account / password page ============ */
.rule-list {
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.rule-list li {
  position: relative;
  padding-left: 18px;
  font-size: 12px;
  color: var(--color-text-light);
  transition: color var(--dur-fast) var(--ease);
}
.rule-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(0,0,0,0.08);
  transition: background var(--dur-fast) var(--ease);
}
.rule-list li.rule-ok { color: var(--color-success); }
.rule-list li.rule-ok::before {
  background: var(--color-success);
  box-shadow: inset 0 0 0 2px var(--color-success);
}
.admin-warning {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(179, 107, 0, 0.08);
  color: var(--color-warn);
  font-size: 12.5px;
  line-height: 1.55;
}
.admin-warning code {
  background: rgba(0,0,0,0.06);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}

/* ============ Placeholder pages ============ */
.placeholder-card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 72px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}
.placeholder-icon {
  width: 48px; height: 48px;
  color: var(--color-text-light);
}
.placeholder-title { font-size: 19px; font-weight: 600; letter-spacing: -0.012em; }
.placeholder-desc { font-size: 13.5px; color: var(--color-text-light); }

/* ============ Error pages ============ */
.error-body {
  background: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.error-container {
  text-align: center;
  max-width: 380px;
}
.error-code {
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--color-text-light);
  line-height: 1;
}
.error-title {
  margin-top: 12px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.error-desc {
  margin-top: 10px;
  font-size: 13.5px;
  color: var(--color-text-light);
}
.error-actions {
  margin-top: 28px;
  display: flex;
  justify-content: center;
}

/* ============ Responsive ============ */
@media (max-width: 720px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: 0;
    border-bottom: 1px solid var(--color-divider-soft);
    padding: 12px;
  }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .nav-item { flex: 1 1 auto; min-width: 88px; }
  .sidebar-footer { border-top: 1px solid var(--color-divider-soft); padding-top: 10px; }
  .content { padding: 24px 18px; max-width: none; }
  .module-grid { grid-template-columns: 1fr; }
  .download-grid { grid-template-columns: 1fr; }
  .user-table { font-size: 12.5px; }
  .user-table thead th, .user-table tbody td { padding: 10px 14px; }
  .parsed-row { grid-template-columns: 80px 1fr; }
  .traffic-used { font-size: 20px; }
}
