﻿/* ═══════════════════════════════════════════════════════
   CAFE STOCK TRACKER — PREMIUM DARK GLASS THEME
   Theme-only upgrade: same layout, same classes,
   same positions — just a more polished aesthetic.
   ═══════════════════════════════════════════════════════ */

/* ── Design Tokens ──────────────────────────────────── */
:root {
  /* Core palette */
  --bg: #030303;
  --bg-surface: #090909;
  --bg-card: rgba(12, 12, 12, 0.9);
  --bg-hover: rgba(255, 255, 255, 0.045);
  --line: rgba(255, 255, 255, 0.08);
  --line-glow: rgba(255, 255, 255, 0.22);
  --text: #f5f5f5;
  --muted: #a6a6a6;
  --dim: #676767;
  --accent: #f7f7f7;
  --accent-2: #7f7f7f;
  --danger: #f87171;
  --warning: #fbbf24;
  --ok: #34d399;
  --shadow: 0 22px 44px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 0 46px rgba(255, 255, 255, 0.03);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-width: 230px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  color: var(--text);
  background: var(--bg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Outfit', 'Inter', sans-serif;
  letter-spacing: -0.02em;
}

/* ── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.24);
}

/* ── Background Layer ───────────────────────────────── */
.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse at 15% 5%, rgba(255, 255, 255, 0.05) 0%, transparent 48%),
    radial-gradient(ellipse at 85% 0%, rgba(255, 255, 255, 0.04) 0%, transparent 38%),
    radial-gradient(ellipse at 50% 100%, rgba(255, 255, 255, 0.025) 0%, transparent 52%),
    repeating-linear-gradient(145deg,
      rgba(255, 255, 255, 0.008) 0, rgba(255, 255, 255, 0.008) 1px,
      transparent 1px, transparent 22px);
}

.bg-layer::before,
.bg-layer::after {
  content: '';
  position: absolute;
  inset: 0;
}

.bg-layer::before {
  background:
    linear-gradient(rgba(3, 3, 3, 0.78), rgba(3, 3, 3, 0.88)),
    url('../images/boston-logo.png') 0 0 / 190px auto repeat,
    url('../images/boston-logo.png') 96px 88px / 190px auto repeat;
  filter: brightness(0) invert(1) grayscale(1) contrast(0.7) blur(0.35px);
  opacity: 0.085;
  transform: rotate(-14deg) scale(1.16);
  transform-origin: center;
}

.bg-layer::after {
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

/* ── Container ──────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.content-shell {
  min-width: 0;
  padding: 0 18px 96px;
}

.mobile-nav-toggle,
.mobile-nav-backdrop {
  display: none;
}

#passwordGate,
.app-header,
.layout {
  width: 100%;
  max-width: none;
  margin-inline: 0;
  padding-inline: 0;
  position: relative;
  z-index: 1;
}

.sidebar {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 14px;
  overflow: auto;
  z-index: 3;
  border-right: 1px solid var(--line);
  border-left: none;
  border-radius: 0;
  background: rgba(6, 6, 6, 0.94);
}

.sidebar-brand {
  margin-bottom: 14px;
}

.brand-logo {
  width: 100%;
  max-width: 180px;
  height: auto;
  display: block;
  margin: 4px 0 10px;
  filter: invert(1) brightness(1.15) drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
}

.sidebar-brand h2 {
  margin: 6px 0 0;
  font-size: 1.1rem;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.sidebar-auth {
  margin-top: auto;
}

.nav-link {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition);
}

.nav-link:hover {
  text-decoration: none;
  border-color: var(--line-glow);
  background: var(--bg-hover);
}

.nav-link.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

/* ═══════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════ */
.app-header {
  display: none;
  padding: 26px 18px 16px;
}

.title-block h1 {
  margin: 8px 0 0;
  font-size: clamp(1.7rem, 2.8vw, 2.6rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--text) 30%, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-logo {
  width: 100%;
  max-width: 240px;
  height: auto;
  margin-top: 6px;
  filter: invert(1) brightness(1.15);
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  letter-spacing: 0.1em;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* Auth Card */
.auth-card,
.panel,
.kpi {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow), var(--shadow-glow);
  transition: transform var(--transition), box-shadow var(--transition);
}

.auth-card:hover,
.panel:hover {
  box-shadow: var(--shadow), 0 0 50px rgba(255, 255, 255, 0.03);
}

.auth-card {
  padding: 14px;
}

.sidebar .auth-card {
  box-shadow: none;
}

.sidebar .auth-form {
  grid-template-columns: 1fr;
}

.sidebar #logoutBtn {
  width: 100%;
}

.auth-state {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.auth-state.admin,
.auth-state.manager {
  color: var(--ok);
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.08);
}

.auth-state.guest {
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 8px;
}

/* ═══════════════════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════════════════ */
h1,
h2,
h3,
h4 {
  font-weight: 700;
  line-height: 1.3;
}

h2 {
  font-size: 1.08rem;
}

h3 {
  font-size: 0.95rem;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85em;
}

/* ═══════════════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════════════ */
button,
input,
select {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(8, 14, 24, 0.7);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

input::placeholder {
  color: var(--dim);
}

input[type="checkbox"] {
  width: auto;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════ */
button,
.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), filter var(--transition), box-shadow var(--transition);
}

button:hover,
.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.08);
}

button:active,
.btn:active {
  transform: translateY(0);
}

.btn.subtle {
  background: rgba(30, 45, 72, 0.5);
  border-color: var(--line);
  color: var(--text);
  box-shadow: none;
}

.btn.subtle:hover {
  background: var(--bg-hover);
  border-color: var(--line-glow);
  box-shadow: 0 2px 12px rgba(255, 255, 255, 0.05);
}

.btn.danger {
  background: rgba(248, 113, 113, 0.18);
  border-color: rgba(248, 113, 113, 0.45);
  color: var(--danger);
}

.btn.danger:hover {
  background: rgba(248, 113, 113, 0.28);
}

/* ── Utility ────────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════ */
.layout {
  padding-bottom: 32px;
  display: grid;
  gap: 16px;
}

/* ═══════════════════════════════════════════════════════
   PASSWORD GATE
   ═══════════════════════════════════════════════════════ */
.password-panel {
  margin-bottom: 14px;
  padding: 16px;
}

.password-panel h2 {
  margin: 0 0 4px;
}

.password-panel p {
  margin: 0 0 12px;
  color: var(--muted);
}

.password-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
}

/* ═══════════════════════════════════════════════════════
   KPI CARDS
   ═══════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.kpi {
  padding: 16px;
  position: relative;
  overflow: hidden;
  animation: kpiFadeIn 0.6s ease both;
}

.kpi::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0.6;
}

.kpi:nth-child(2) {
  animation-delay: 0.08s;
}

.kpi:nth-child(3) {
  animation-delay: 0.16s;
}

.kpi:nth-child(4) {
  animation-delay: 0.24s;
}

.kpi:nth-child(5) {
  animation-delay: 0.32s;
}

@keyframes kpiFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.kpi:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow), 0 0 30px rgba(255, 255, 255, 0.04);
}

.kpi .label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 8px;
}

.kpi strong {
  font-size: 1.3rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--text);
}

.kpi.warning strong {
  color: var(--warning);
}

/* ═══════════════════════════════════════════════════════
   PANELS
   ═══════════════════════════════════════════════════════ */
.panel {
  padding: 14px;
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.08rem;
}

.panel-actions {
  display: flex;
  gap: 8px;
}

/* ═══════════════════════════════════════════════════════
   FILTERS & CATEGORY TABS
   ═══════════════════════════════════════════════════════ */
.filters {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
}

.category-tabs {
  display: none;
}

.category-tab {
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 7px 16px;
  font-size: 0.82rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}

.category-tab:hover {
  background: var(--bg-hover);
  border-color: var(--line-glow);
  color: var(--text);
}

.category-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(255, 255, 255, 0.12);
}

/* ═══════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════ */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: auto;
  max-width: 100%;
  width: 100%;
}

.main-table {
  max-height: 700px;
}

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

.main-table table {
  min-width: 1060px;
}

#usersPanel table {
  min-width: 760px;
}

#logsPanel table {
  min-width: 980px;
}

#usagePanel table {
  min-width: 840px;
}

#visitorsPanel table {
  min-width: 980px;
}

.scroll-sentinel {
  height: 1px;
}

thead {
  background: rgba(8, 8, 8, 0.98);
  position: sticky;
  top: 0;
  z-index: 2;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.86rem;
  text-align: left;
  vertical-align: middle;
}

th {
  font-weight: 600;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color var(--transition);
}

th.sortable:hover {
  color: var(--accent);
}

th.sortable::after {
  content: '↕';
  margin-left: 6px;
  color: var(--dim);
  font-size: 0.72rem;
}

th.sorted-asc::after {
  content: '↑';
  color: var(--accent);
}

th.sorted-desc::after {
  content: '↓';
  color: var(--accent);
}

tr {
  transition: background var(--transition);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.table-footer {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.pager {
  display: flex;
  gap: 8px;
}

/* ═══════════════════════════════════════════════════════
   PRODUCT IMAGES & TAGS
   ═══════════════════════════════════════════════════════ */
.product-img {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: rgba(6, 10, 16, 0.8);
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--line);
  letter-spacing: 0.02em;
}

.tag.low {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(248, 113, 113, 0.12);
}

.tag.warn {
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.1);
}

.tag.good {
  color: #a7f3d0;
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.1);
}

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

.row-actions .btn {
  padding: 6px 10px;
  font-size: 0.76rem;
}

.usage-insights {
  margin: 14px 0 12px;
}

.usage-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.usage-cards .kpi {
  padding: 10px;
}

.usage-cards .kpi strong {
  font-size: 1.05rem;
}

.usage-cards .kpi small {
  display: block;
  margin-top: 5px;
}

.usage-ai-summary {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(8, 14, 24, 0.55);
}

.usage-top-products {
  margin-top: 12px;
}

.usage-top-products h3 {
  margin: 0 0 8px;
  font-size: 0.9rem;
}

.usage-top-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.usage-top-track .hint {
  padding: 6px 2px;
}

.usage-top-card {
  min-width: 260px;
  max-width: 300px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(10, 10, 10, 0.82);
  padding: 10px;
  flex: 0 0 auto;
  overflow: hidden;
}

.usage-top-head {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}

.usage-top-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 22px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 700;
}

.usage-top-stats {
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.usage-top-stats div {
  margin: 0;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.usage-top-stats dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.usage-top-stats dd {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 600;
}

.site-footer {
  position: fixed;
  left: auto;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  pointer-events: none;
}

.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: auto;
  box-shadow: none;
}

.site-footer__owner {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.site-footer__wa {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #d1fae5;
  font-size: 0.84rem;
  font-weight: 600;
}

.site-footer__wa:hover {
  color: #a7f3d0;
  text-decoration: none;
}

.site-footer__wa-icon {
  width: 17px;
  height: 17px;
  color: #22c55e;
}

.visitor-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 10px;
}

.user-role {
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.user-actions-menu {
  display: inline-flex;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.icon-btn:hover {
  background: var(--bg-hover);
  border-color: var(--line-glow);
}

.user-edit-btn {
  white-space: nowrap;
}

.user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 190px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(10, 10, 10, 0.98);
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 15;
}

.user-menu button {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.82rem;
  cursor: pointer;
}

.user-menu button:hover {
  background: var(--bg-hover);
}

/* ═══════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════ */
.alerts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.alerts-grid h3 {
  margin: 0 0 10px;
  font-size: 0.94rem;
  color: var(--text);
}

.alert-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
}

.alert-list li {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

.alert-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 5px 4px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.alert-item:hover {
  background: var(--bg-hover);
}

.alert-img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(8, 8, 8, 0.82);
  object-fit: cover;
}

.log-detail,
.usage-product {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.log-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: rgba(8, 8, 8, 0.82);
}

.log-title {
  margin: 0;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.log-subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.log-detail > div,
.usage-product > div,
.alert-item > div {
  min-width: 0;
}

/* ═══════════════════════════════════════════════════════
   INLINE FORMS
   ═══════════════════════════════════════════════════════ */
.inline-form.compact {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.user-create-form {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: center;
  margin-bottom: 14px;
}

.inline-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

/* ═══════════════════════════════════════════════════════
   HINT TEXT
   ═══════════════════════════════════════════════════════ */
.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* ═══════════════════════════════════════════════════════
   PDF (if used)
   ═══════════════════════════════════════════════════════ */
.pdf-upload-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 8px;
}

/* ═══════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(3, 6, 12, 0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 14px;
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-card {
  width: min(820px, 100%);
  max-height: calc(100vh - 24px);
  overflow: auto;
  background: linear-gradient(180deg, rgba(16, 26, 42, 0.98), rgba(10, 17, 30, 0.98));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), var(--shadow-glow);
  animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-card.large {
  width: min(1100px, 100%);
}

.modal-card.compact {
  width: min(520px, 100%);
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 4px;
}

.full-span {
  grid-column: 1 / -1;
}

.panel-head.compact {
  margin-bottom: 8px;
}

.panel-head.compact h3 {
  margin: 0;
  font-size: 0.95rem;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(8, 14, 24, 0.7);
}

#userModal .modal-card {
  width: min(760px, 100%);
}

.stock-form {
  display: grid;
  gap: 12px;
  padding: 4px;
}

.stock-stepper {
  display: grid;
  grid-template-columns: auto auto 1fr auto auto;
  gap: 8px;
  align-items: center;
}

.modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.modal-actions.spaced {
  justify-content: space-between;
}

/* ═══════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  background: rgba(14, 22, 38, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
  }

  .content-shell {
    padding: 64px 12px 24px;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 24;
    height: 40px;
    min-width: 82px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(8, 8, 8, 0.96);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow: var(--shadow);
  }

  .mobile-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 22;
    background: rgba(2, 6, 14, 0.62);
    backdrop-filter: blur(2px);
  }

  .mobile-nav-backdrop.hidden {
    display: none;
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(86vw, 320px);
    max-width: 320px;
    height: 100vh;
    border-radius: 0 16px 16px 0;
    border-left: none;
    transform: translateX(-106%);
    transition: transform var(--transition);
    z-index: 23;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-nav {
    grid-template-columns: 1fr;
    margin-bottom: 10px;
  }

  .sidebar-auth {
    margin-top: auto;
  }

  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .site-footer {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    margin-top: 14px;
    pointer-events: auto;
  }
}

@media (max-width: 920px) {
  .password-form,
  .filters,
  .pdf-upload-form,
  .inline-form.compact {
    grid-template-columns: 1fr;
  }

  .user-create-form {
    grid-template-columns: 1fr;
  }

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

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .usage-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-footer {
    margin-top: 12px;
  }

  .site-footer__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .stock-stepper {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .main-table table {
    min-width: 0;
  }

  .main-table thead {
    display: none;
  }

  .main-table tbody tr {
    display: grid;
    gap: 6px;
    padding: 12px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    background: rgba(8, 8, 8, 0.82);
    margin-bottom: 10px;
  }

  .main-table tbody td {
    display: grid;
    grid-template-columns: minmax(100px, 118px) minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 6px 4px;
    border-bottom: none;
    text-align: left;
  }

  .main-table tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: left;
  }

  .main-table tbody td[data-label='Foto']::before {
    content: '';
  }

  .main-table tbody td[data-label='Foto'] {
    justify-content: flex-start;
    grid-template-columns: 1fr;
    padding-bottom: 0;
    min-height: 64px;
  }

  .main-table tbody td[data-label='İşlemler'] {
    justify-content: flex-start;
    flex-wrap: wrap;
    grid-template-columns: 1fr;
    padding-top: 2px;
  }

  .main-table tbody td[data-label='Kategori'],
  .main-table tbody td[data-label='Uyarı Eşiği'] {
    display: none;
  }

  .main-table tbody td[data-label='Ürün'] {
    font-size: 0.92rem;
    font-weight: 600;
    align-items: start;
  }

  .main-table .row-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .main-table .row-actions .btn:last-child {
    grid-column: 1 / -1;
  }

  .main-table .row-actions .btn {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding: 0;
  }

  .sidebar-nav {
    grid-template-columns: 1fr;
  }

  .content-shell {
    padding: 62px 8px 16px;
  }

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

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

  .usage-cards {
    grid-template-columns: 1fr;
  }

  .usage-top-card {
    min-width: 220px;
  }

  th,
  td {
    font-size: 0.8rem;
    padding: 8px;
  }
}

/* ═══════════════════════════════════════════════════════
   BRAND OVERRIDES — LOCAL UX REFRESH
   ═══════════════════════════════════════════════════════ */
.content-shell {
  padding: 18px 18px 112px;
}

.app-toolbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: 56px;
  padding: 6px 0 10px;
}

.app-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.notification-shell {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.notification-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: min(420px, calc(100vw - 40px));
  max-height: 420px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(10, 10, 10, 0.96);
  box-shadow: var(--shadow);
  padding: 12px;
}

.notification-dropdown .panel-head {
  margin-bottom: 10px;
}

.notification-dropdown .panel-head h3 {
  margin: 0;
  font-size: 1rem;
}

.notification-dropdown select {
  min-width: 170px;
}

.notification-list {
  display: grid;
  gap: 8px;
  max-height: 330px;
  overflow-y: auto;
  padding-right: 4px;
}

.notification-item {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.notification-item.is-unread {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.045);
}

.notification-item__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  box-shadow: 0 0 12px currentColor;
}

.notification-item__dot.stock {
  color: var(--warning);
  background: currentColor;
}

.notification-item__dot.login {
  color: #d4d4d4;
  background: currentColor;
}

.notification-item__dot.system {
  color: var(--ok);
  background: currentColor;
}

.notification-item strong {
  display: block;
  margin-bottom: 3px;
  font-size: 0.92rem;
}

.notification-item p,
.notification-item small {
  margin: 0;
  color: var(--muted);
}

.notification-item__date {
  display: block;
  margin-top: 6px;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.42);
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ok);
  color: #04150d;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0 5px;
  box-shadow: 0 0 18px rgba(52, 211, 153, 0.4);
}

.notification-shell .icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--text);
}

.notification-shell .icon-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  box-shadow: none;
}

.icon-btn__glyph {
  font-size: 1.22rem;
  line-height: 1;
}

.about-trigger {
  margin-top: 10px;
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--text);
}

.about-content {
  display: grid;
  gap: 10px;
  color: var(--muted);
}

.about-content p {
  margin: 0;
}

.about-content a {
  color: var(--text);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.nav-link__icon {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.92rem;
}

.nav-link.active .nav-link__icon {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.15);
}

.panel,
.auth-card,
.kpi,
.modal-card,
.notification-dropdown {
  border-color: rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(13, 13, 13, 0.95), rgba(6, 6, 6, 0.92));
}

.panel-head h2 {
  font-size: clamp(1.08rem, 1vw + 0.9rem, 1.45rem);
  font-weight: 800;
}

.alerts-grid h3,
.panel-head.compact h3 {
  font-size: 1rem;
  font-weight: 700;
}

.kpi .label {
  font-size: 0.76rem;
  letter-spacing: 0.08em;
}

.kpi strong {
  font-size: clamp(1.25rem, 1vw + 1rem, 1.75rem);
}

button,
.btn {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  color: #050505;
}

button:hover,
.btn:hover {
  box-shadow: 0 10px 26px rgba(255, 255, 255, 0.06);
}

button:active,
.btn:active {
  transform: scale(0.95);
}

.btn.subtle {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.btn.subtle:hover {
  box-shadow: 0 10px 22px rgba(255, 255, 255, 0.04);
}

.btn.danger,
.icon-btn,
.about-trigger,
.site-footer__wa {
  color: var(--text);
}

.nav-link.active {
  color: #050505;
}

.table-wrap {
  border-radius: 16px;
}

tbody tr {
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

tbody tr:hover td {
  background: rgba(255, 255, 255, 0.028);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

tbody tr:hover {
  transform: translateY(-1px);
}

.main-table th:first-child,
.main-table td:first-child {
  width: 92px;
  min-width: 92px;
}

.main-table td:nth-child(3),
.main-table tbody td[data-label='Ürün'] {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.row-critical td {
  position: relative;
}

.row-critical td:first-child::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  border-radius: 999px;
  background: rgba(248, 113, 113, 0.85);
  box-shadow: 0 0 16px rgba(248, 113, 113, 0.55);
  animation: criticalPulse 1.4s ease-in-out infinite;
}

@keyframes criticalPulse {
  0%,
  100% {
    opacity: 0.55;
    transform: scaleY(0.92);
  }

  50% {
    opacity: 1;
    transform: scaleY(1);
  }
}

.product-img,
.alert-img,
.log-thumb {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.product-img:hover,
.alert-img:hover,
.log-thumb:hover {
  transform: scale(1.18);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 5;
}

.tag.low {
  animation: urgentGlow 1.6s ease-in-out infinite;
  color: #ffe4e4;
  border-color: rgba(248, 113, 113, 0.45);
  text-shadow: 0 0 12px rgba(248, 113, 113, 0.42);
  box-shadow: 0 0 18px rgba(248, 113, 113, 0.16), inset 0 0 0 1px rgba(248, 113, 113, 0.14);
}

.alert-item.critical {
  animation: urgentGlow 1.8s ease-in-out infinite;
  border-color: rgba(248, 113, 113, 0.24);
}

@keyframes urgentGlow {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(248, 113, 113, 0);
  }

  50% {
    box-shadow: 0 0 20px rgba(248, 113, 113, 0.16);
  }
}

.alert-list li {
  margin-bottom: 8px;
}

.alert-item {
  padding: 7px 6px;
}

.site-footer {
  position: fixed !important;
  right: 18px;
  bottom: 18px;
  left: auto;
  z-index: 40;
  padding: 0;
  background: transparent;
  border: none;
}

.site-footer__inner {
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
}

.site-footer__wa {
  border-radius: 999px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(10, 10, 10, 0.96);
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.site-footer__wa:hover {
  transform: translateY(-2px);
}

.action-feedback {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 30;
}

.action-feedback__card {
  min-width: min(420px, calc(100vw - 40px));
  max-width: 520px;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 28px 26px;
  border: 1px solid rgba(52, 211, 153, 0.28);
  border-radius: 22px;
  background: rgba(8, 10, 10, 0.96);
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.6), 0 0 32px rgba(52, 211, 153, 0.12);
  text-align: center;
}

.action-feedback__icon {
  width: 76px;
  height: 76px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(86, 255, 181, 0.92), rgba(17, 120, 77, 0.9));
  color: #04150d;
  font-size: 2.5rem;
  font-weight: 900;
  box-shadow: 0 0 26px rgba(52, 211, 153, 0.38);
}

.action-feedback__card strong {
  font-size: 1.25rem;
}

.action-feedback__card span:last-child {
  color: var(--muted);
}

.toast {
  right: 18px;
  bottom: 86px;
  top: auto;
  border-radius: 14px;
  background: rgba(10, 10, 10, 0.96);
}

body.page-ready .content-shell {
  animation: pageEnter 0.24s ease both;
}

body.page-transitioning .content-shell {
  opacity: 0;
}

@keyframes pageEnter {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@media (max-width: 1100px) {
  .app-toolbar {
    padding-top: 52px;
  }
}

@media (max-width: 780px) {
  .notification-dropdown {
    width: min(360px, calc(100vw - 22px));
  }

  .site-footer {
    right: 12px;
    bottom: 12px;
  }

  .site-footer__wa {
    padding: 11px 14px;
    font-size: 0.84rem;
  }
}

@media (max-width: 620px) {
  .app-toolbar {
    min-height: 42px;
    padding: 54px 0 8px;
  }

  .notification-dropdown {
    right: -4px;
  }

  .product-img,
  .alert-img,
  .log-thumb {
    width: 56px;
    height: 56px;
  }

  .product-img:hover,
  .alert-img:hover,
  .log-thumb:hover {
    transform: scale(1.08);
  }
}
