:root {
  --ink: #2a1f16;
  --muted: #7a6554;
  --accent: #e08a3c;
  --accent-2: #f0a35a;
  --danger: #c0392b;
  --ok: #d9893b;
  --warn: #c4741a;
  --glass: rgba(255, 255, 255, 0.42);
  --glass-strong: rgba(255, 255, 255, 0.58);
  --glass-soft: rgba(255, 255, 255, 0.28);
  --glass-dark: rgba(62, 38, 22, 0.38);
  --glass-dark-strong: rgba(48, 28, 16, 0.45);
  --stroke: rgba(255, 255, 255, 0.55);
  --stroke-dark: rgba(255, 255, 255, 0.22);
  --stroke-ink: rgba(42, 31, 22, 0.12);
  --specular: inset 0 1px 0 rgba(255, 255, 255, 0.65), inset 0 -1px 0 rgba(255, 255, 255, 0.08);
  --shadow: 0 10px 40px rgba(70, 40, 18, 0.1), 0 2px 8px rgba(70, 40, 18, 0.05);
  --shadow-lg: 0 24px 60px rgba(70, 40, 18, 0.14);
  --blur: 22px;
  --blur-strong: 32px;
  --radius: 20px;
  --radius-sm: 14px;
  --font: "Sora", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sidebar-w: 272px;
  --mobile-top-h: 58px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  background-color: #f3e6d8;
  background-image:
    radial-gradient(ellipse 70% 55% at 12% 8%, rgba(255, 186, 120, 0.55), transparent 60%),
    radial-gradient(ellipse 55% 45% at 88% 12%, rgba(255, 214, 170, 0.5), transparent 55%),
    radial-gradient(ellipse 50% 40% at 70% 85%, rgba(240, 190, 150, 0.4), transparent 60%),
    radial-gradient(ellipse 40% 35% at 20% 75%, rgba(255, 200, 150, 0.35), transparent 55%),
    linear-gradient(160deg, #f7ebe0 0%, #f0dcc8 45%, #f4e8dc 100%);
  background-attachment: fixed;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.35), transparent 28%),
    radial-gradient(circle at 75% 60%, rgba(255, 255, 255, 0.2), transparent 32%);
  animation: liquidDrift 18s var(--ease) infinite alternate;
}
@keyframes liquidDrift {
  from { transform: translate3d(0, 0, 0) scale(1); opacity: 0.7; }
  to { transform: translate3d(-2%, 1.5%, 0) scale(1.05); opacity: 1; }
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s var(--ease); }
a:hover { text-decoration: underline; }

/* Glass utility feel */
.glass {
  background: var(--glass);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow), var(--specular);
}

/* —— Sidebar (dark liquid glass) —— */
.app-shell .sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  z-index: 40;
  display: flex;
  flex-direction: column;
  padding: calc(1.15rem + var(--safe-top)) 0.9rem calc(1rem + var(--safe-bottom));
  background: linear-gradient(165deg, rgba(90, 48, 24, 0.38), rgba(58, 30, 14, 0.42));
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  color: #fff6ee;
  border-right: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: none;
  transition: transform 0.4s var(--ease-out);
  will-change: transform;
}
.app-shell .sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 28%),
    radial-gradient(ellipse 80% 40% at 20% 0%, rgba(255, 180, 110, 0.22), transparent 55%);
  border-radius: inherit;
}
.sidebar-brand {
  position: relative;
  padding: 0.4rem 0.8rem 1.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  margin-bottom: 1rem;
}
.sidebar .brand {
  font-weight: 700;
  font-size: 1.28rem;
  color: #fff;
  letter-spacing: -0.03em;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.25s var(--ease);
}
.sidebar .brand:hover { transform: translateX(2px); text-decoration: none; }
.sidebar .brand span { color: #ffc48a; }
.sidebar-tag {
  margin: 0.4rem 0 0;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 246, 238, 0.55);
  font-weight: 600;
}
.nav-section {
  margin: 0.45rem 0.8rem 0.45rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 246, 238, 0.42);
  font-weight: 700;
}
.sidebar-nav {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.sidebar-foot {
  position: relative;
  margin-top: auto;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.74rem 0.9rem;
  border-radius: 14px;
  color: rgba(255, 246, 238, 0.82);
  font-weight: 600;
  font-size: 0.94rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease), border-color 0.25s var(--ease);
  min-height: 46px;
}
.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-decoration: none;
  transform: translateX(2px);
}
.nav-link.active {
  background: rgba(255, 180, 110, 0.22);
  border-color: rgba(255, 190, 130, 0.35);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.nav-link.active:hover { transform: none; }
.nav-link.logout { color: rgba(255, 246, 238, 0.6); }
.nav-link.logout:hover {
  color: #ffc4bc;
  background: rgba(192, 57, 43, 0.18);
  border-color: rgba(255, 160, 150, 0.2);
}
.nav-ico {
  display: inline-grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  flex-shrink: 0;
  opacity: 0.92;
}
.nav-ico svg { width: 1.15rem; height: 1.15rem; }

.app-main {
  position: relative;
  z-index: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.mobile-top {
  display: none;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--mobile-top-h);
  padding: calc(0.55rem + var(--safe-top)) 0.9rem 0.55rem;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--stroke);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  position: sticky;
  top: 0;
  z-index: 30;
}
.mobile-brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  letter-spacing: 0.06em;
  text-decoration: none;
}
.mobile-brand span { color: var(--accent); }
.mobile-spacer { width: 2.5rem; }
.nav-toggle {
  width: 2.55rem;
  height: 2.55rem;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  box-shadow: var(--specular);
  transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}
.nav-toggle:active { transform: scale(0.96); }
.nav-toggle span {
  display: block;
  width: 1.05rem;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform 0.28s var(--ease), opacity 0.2s var(--ease);
}
body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; transform: scaleX(0.4); }
body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(10, 24, 20, 0.28);
  backdrop-filter: blur(6px) saturate(120%);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  border: 0;
  padding: 0;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
body.nav-open .sidebar-backdrop {
  display: block;
  opacity: 1;
}
.sidebar-backdrop[hidden] { display: none !important; }

.wrap {
  width: min(1080px, calc(100% - 2.25rem));
  margin: 1.5rem auto 3rem;
  flex: 1;
  position: relative;
  z-index: 1;
}
.auth-wrap { width: min(1080px, calc(100% - 2rem)); margin: 0 auto; }
.auth-main { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; }

.page-enter { animation: pageIn 0.5s var(--ease-out) both; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes slideCard {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.35rem;
}
.page-head h1 { margin: 0; font-size: clamp(1.4rem, 4vw, 1.75rem); letter-spacing: -0.03em; }
.sub { color: var(--muted); margin: 0.35rem 0 0; line-height: 1.45; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 700;
  margin: 0;
}

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.35rem 0 0.75rem;
}
.section-label h2 {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 700;
}

.panel {
  background: var(--glass);
  backdrop-filter: blur(var(--blur)) saturate(165%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(165%);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow), var(--specular);
  margin-bottom: 1rem;
  transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease), background 0.28s var(--ease);
}
.panel:hover {
  background: var(--glass-strong);
  box-shadow: var(--shadow-lg), var(--specular);
}
.panel.narrow { max-width: 560px; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}
.panel-head h2 { margin: 0; font-size: 1.08rem; letter-spacing: -0.02em; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}
.stat {
  background: var(--glass-soft);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 1.05rem 1.1rem;
  box-shadow: var(--shadow), var(--specular);
  animation: riseIn 0.5s var(--ease-out) both;
  transition: transform 0.28s var(--ease), background 0.28s var(--ease);
}
.stat:nth-child(1) { animation-delay: 0.04s; }
.stat:nth-child(2) { animation-delay: 0.08s; }
.stat:nth-child(3) { animation-delay: 0.12s; }
.stat:nth-child(4) { animation-delay: 0.16s; }
.stat:hover {
  transform: translateY(-3px);
  background: var(--glass-strong);
}
.stat .label { display: block; color: var(--muted); font-size: 0.78rem; margin-bottom: 0.4rem; font-weight: 600; }
.stat strong { font-size: 1.55rem; letter-spacing: -0.03em; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.15rem; }
.svc-meta { display: grid; gap: 0.35rem; margin: 0.15rem 0 0.25rem; }
.svc-meta span {
  display: flex;
  gap: 0.45rem;
  align-items: baseline;
  color: var(--muted);
  font-size: 0.82rem;
}
.svc-meta strong { color: var(--ink); font-family: var(--mono); font-size: 0.82rem; font-weight: 600; }

.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.62rem 1.1rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  min-height: 42px;
  touch-action: manipulation;
  box-shadow: var(--specular);
  transition: background 0.22s var(--ease), border-color 0.22s var(--ease), transform 0.22s var(--ease), box-shadow 0.22s var(--ease);
}
.btn:hover, button.btn:hover {
  text-decoration: none;
  background: rgba(255, 255, 255, 0.72);
  transform: translateY(-1px);
}
.btn:active, button.btn:active { transform: translateY(0) scale(0.98); }
.btn.primary {
  background: linear-gradient(145deg, rgba(240, 163, 90, 0.95), rgba(224, 138, 60, 0.96));
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
  box-shadow: 0 10px 28px rgba(224, 138, 60, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn.primary:hover {
  background: linear-gradient(145deg, rgba(245, 175, 105, 0.98), rgba(210, 120, 45, 0.98));
  color: #fff;
}
.btn.danger {
  color: var(--danger);
  border-color: rgba(192, 57, 43, 0.25);
  background: rgba(255, 245, 243, 0.55);
}
.btn.danger:hover { background: rgba(255, 235, 232, 0.85); }
.btn.sm { min-height: 36px; padding: 0.4rem 0.85rem; font-size: 0.82rem; }
.inline-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.95rem; }

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 0.18rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: var(--muted);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.pill.on, .pill.active {
  background: rgba(255, 232, 205, 0.8);
  color: var(--ok);
  border-color: rgba(224, 138, 60, 0.28);
}
.pill.off, .pill.disabled { background: rgba(238, 238, 238, 0.7); color: #777; }
.pill.expired {
  background: rgba(251, 232, 198, 0.8);
  color: var(--warn);
  border-color: rgba(183, 106, 18, 0.2);
}

.mono { font-family: var(--mono); font-size: 0.85rem; }
.tiny { font-size: 0.78rem; color: var(--muted); }
.dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  margin-left: 0.35rem;
  background: #bbb;
  vertical-align: middle;
}
.dot.on {
  background: #e08a3c;
  box-shadow: 0 0 0 3px rgba(224, 138, 60, 0.25);
  animation: pulse 2s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(224, 138, 60, 0.25); }
  50% { box-shadow: 0 0 0 6px rgba(224, 138, 60, 0.1); }
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.desktop-table { width: 100%; border-collapse: collapse; }
.desktop-table th, .desktop-table td {
  text-align: left;
  padding: 0.8rem 0.5rem;
  border-bottom: 1px solid rgba(18, 36, 31, 0.08);
  vertical-align: top;
}
.desktop-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.desktop-table tbody tr { transition: background 0.2s var(--ease); }
.desktop-table tbody tr:hover { background: rgba(255, 255, 255, 0.35); }
.row-actions { display: flex; gap: 0.55rem; flex-wrap: wrap; align-items: center; }
.row-actions a, .linkish {
  background: none; border: none; padding: 0.3rem 0.1rem; font: inherit; font-size: 0.85rem;
  color: var(--accent); cursor: pointer; font-weight: 600;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  transition: opacity 0.2s var(--ease);
}
.row-actions a:hover, .linkish:hover { opacity: 0.75; }
.linkish.danger { color: var(--danger); }

.client-cards { display: none; gap: 0.75rem; }
.client-card {
  background: rgba(255, 255, 255, 0.38);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 1rem;
  display: grid;
  gap: 0.75rem;
  box-shadow: var(--specular);
  animation: slideCard 0.42s var(--ease-out) both;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease);
}
.client-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.55);
}
.client-card:nth-child(1) { animation-delay: 0.03s; }
.client-card:nth-child(2) { animation-delay: 0.07s; }
.client-card:nth-child(3) { animation-delay: 0.11s; }
.client-card:nth-child(4) { animation-delay: 0.15s; }
.client-card:nth-child(5) { animation-delay: 0.19s; }
.client-card-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.75rem;
}
.client-card-top h3 {
  margin: 0;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.client-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.75rem;
}
.meta-item { display: grid; gap: 0.15rem; }
.meta-item .k {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}
.meta-item .v { font-size: 0.84rem; word-break: break-word; }
.client-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding-top: 0;
  border-top: none;
}
.empty-state {
  text-align: center;
  padding: 1.75rem 1rem;
  color: var(--muted);
}

.stack { display: grid; gap: 0.95rem; }
.form-section {
  display: grid;
  gap: 0.85rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--specular);
}
.form-section h3 {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
label { display: grid; gap: 0.35rem; font-weight: 600; font-size: 0.9rem; }
input[type=text],
input[type=password],
input[type=number],
input[type=email],
input[type=search],
input[type=url],
input:not([type]) {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  min-height: 44px;
  font-size: 16px;
  box-shadow: inset 0 1px 2px rgba(18, 36, 31, 0.04);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
input[type=text]:focus,
input[type=password]:focus,
input[type=number]:focus,
input[type=email]:focus,
input[type=search]:focus,
input[type=url]:focus,
input:not([type]):focus {
  outline: none;
  border-color: rgba(224, 138, 60, 0.5);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 0 0 3px rgba(224, 138, 60, 0.16);
}
input[readonly] {
  opacity: 0.85;
  cursor: default;
}
fieldset { border: 1px solid var(--stroke); border-radius: 12px; padding: 0.8rem 1rem; background: rgba(255,255,255,0.2); }
legend { padding: 0 0.35rem; font-weight: 700; }
.check {
  font-weight: 500;
  display: flex;
  gap: 0.55rem;
  align-items: center;
  margin: 0.2rem 0;
  min-height: 42px;
  padding: 0.2rem 0.35rem;
  border-radius: 10px;
  transition: background 0.2s var(--ease);
}
.check:hover { background: rgba(255, 255, 255, 0.35); }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }

.flashes { margin-bottom: 1rem; display: grid; gap: 0.5rem; }
.flash {
  padding: 0.8rem 0.95rem;
  border-radius: 14px;
  font-weight: 600;
  animation: riseIn 0.35s var(--ease-out);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--stroke);
}
.flash.ok {
  background: rgba(255, 232, 205, 0.75);
  color: var(--ok);
}
.flash.error {
  background: rgba(253, 232, 230, 0.75);
  color: var(--danger);
}

.login-shell {
  min-height: calc(100vh - 2rem);
  min-height: calc(100dvh - 2rem);
  display: grid;
  place-items: center;
  padding: 1rem 0;
}
.login-card {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.48);
  backdrop-filter: blur(var(--blur-strong)) saturate(170%);
  -webkit-backdrop-filter: blur(var(--blur-strong)) saturate(170%);
  border: 1px solid var(--stroke);
  border-radius: 24px;
  padding: 1.8rem;
  box-shadow: var(--shadow-lg), var(--specular);
  animation: pageIn 0.55s var(--ease-out);
}
.login-card h1 { margin: 0.35rem 0; letter-spacing: -0.03em; }
.login-card .btn.primary { width: 100%; }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .app-shell .sidebar {
    transform: translateX(calc(-100% - 12px));
    width: min(var(--sidebar-w), 88vw);
    border-radius: 0 22px 22px 0;
    border: 1px solid var(--stroke-dark);
    border-left: none;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { display: block; opacity: 0; pointer-events: none; }
  body.nav-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  .app-main { margin-left: 0; }
  .mobile-top { display: flex; }
  .wrap {
    width: min(1080px, calc(100% - 1.15rem));
    margin: 0.95rem auto calc(2rem + var(--safe-bottom));
  }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .btn { width: 100%; }
  .grid-2 { grid-template-columns: 1fr; }
  body.nav-open { overflow: hidden; }
  .desktop-only { display: none !important; }
  .client-cards { display: grid; }
}

@media (min-width: 901px) {
  .mobile-only { display: none !important; }
}

@media (max-width: 520px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 0.65rem; }
  .stat { padding: 0.9rem; }
  .stat strong { font-size: 1.3rem; }
  .panel { padding: 0.95rem 1rem; border-radius: 16px; }
  .inline-actions .btn { flex: 1 1 calc(50% - 0.35rem); }
  .client-meta { grid-template-columns: 1fr; }
  .client-card-actions .btn { flex: 1 1 auto; }
}

@media (max-width: 380px) {
  .stat-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body::before { animation: none; }
  *, *::before, *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}


/* —— Data usage —— */
.usage-stats .stat-split {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 1.05rem;
  line-height: 1.25;
}
.usage-stats .stat-split span {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.75rem;
}
.usage-list {
  display: grid;
  gap: 0.85rem;
}
.usage-big {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.usage-big .k {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 0.2rem;
}
.usage-big strong {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.usage-bar-wrap { margin: 0.35rem 0 0.85rem; }
.usage-bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.usage-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(18, 36, 31, 0.08);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.45);
}
.usage-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(240, 163, 90, 0.9), rgba(224, 138, 60, 0.95));
  transition: width 0.45s var(--ease-out);
  max-width: 100%;
}
.usage-bar-wrap.over .usage-bar span {
  background: linear-gradient(90deg, #e07a5f, #c0392b);
}
.usage-split { margin-bottom: 0.75rem; }
@media (max-width: 620px) {
  .usage-big { grid-template-columns: 1fr; }
}


/* —— Advanced features —— */
select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  min-height: 44px;
  font-size: 16px;
}
select:focus {
  outline: none;
  border-color: rgba(224, 138, 60, 0.5);
  box-shadow: 0 0 0 3px rgba(224, 138, 60, 0.16);
}
.pill.quota { background: rgba(255, 220, 180, 0.85); color: #a85a10; border-color: rgba(224, 138, 60, 0.3); }
.pill.warn, .pill.info { background: rgba(255, 232, 205, 0.8); color: var(--warn); }
.pill.error { background: rgba(253, 232, 230, 0.8); color: var(--danger); }
.nav-badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  margin-left: 0.35rem;
  border-radius: 999px;
  background: #e08a3c;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
}
.qr-box {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
  padding: 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--stroke);
}
.qr-box img {
  border-radius: 12px;
  background: #fff;
  max-width: 100%;
  height: auto;
}
.share-card .btn { width: 100%; margin-top: 0.5rem; }
.alert-list { display: grid; gap: 0.75rem; }
.alert-item .alert-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}
.alert-msg { margin: 0; font-weight: 600; }
.alert-item.level-error { border-color: rgba(192, 57, 43, 0.25); }
.alert-item.level-warn { border-color: rgba(224, 138, 60, 0.3); }


/* —— Bulk + backup —— */
.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(42, 31, 22, 0.08);
}
.bulk-bar select { width: auto; min-width: 160px; flex: 1 1 160px; }
.bulk-all { margin: 0 !important; min-height: auto !important; font-weight: 600; }
input[type=file] {
  width: 100%;
  font: inherit;
  padding: 0.5rem 0;
}


/* —— Share link copy/share —— */
.share-link-box { display: grid; gap: 0.45rem; margin-top: 0.25rem; }
.share-link-box > label { font-weight: 600; font-size: 0.9rem; }
.share-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
}
.share-link-row input {
  flex: 1 1 180px;
  min-width: 0;
}
.share-link-row .btn {
  flex: 0 0 auto;
  min-width: 4.5rem;
}
.share-link-status {
  margin: 0;
  font-weight: 600;
}
.share-link-status.ok { color: var(--ok); }
.share-link-status.err { color: var(--danger); }
@media (max-width: 520px) {
  .share-link-row .btn { flex: 1 1 calc(50% - 0.35rem); }
}


#qr-image { transition: opacity 0.2s ease; }
#qr-image.qr-loading { opacity: 0.45; }
#btn-refresh-qr { margin-left: auto; }


/* Share rotate row: matched height, mobile full-width button */
.share-rotate-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.share-days-field {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
  height: 42px;
  padding: 0 0.7rem 0 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-sizing: border-box;
}
.share-days-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.share-days-field #share-days {
  width: 3.25rem;
  min-height: 0;
  height: 100%;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
  font-size: 0.9rem;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.share-days-field #share-days:focus {
  outline: none;
  box-shadow: none;
  border: 0;
  background: transparent;
}
.share-rotate-row > .btn {
  flex: 1 1 auto;
  min-height: 42px;
  height: 42px;
  padding: 0 1.1rem;
  box-sizing: border-box;
  align-self: stretch;
}
@media (max-width: 520px) {
  .share-rotate-row {
    flex-direction: column;
    align-items: stretch;
  }
  .share-days-field {
    width: 100%;
  }
  .share-days-field #share-days {
    width: 100%;
    flex: 1;
  }
  .share-rotate-row > .btn {
    width: 100%;
    flex: 0 0 auto;
  }
}
