:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-soft: #eff6ff;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --success: #15803d;
  --success-soft: #f0fdf4;
  --warning: #a16207;
  --warning-soft: #fefce8;
  --internal: #fffbeb;
  --internal-border: #fcd34d;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 var(--font); color: var(--text); min-height: 100vh;
  /* Soft colour wash so the glass top bar has something to refract. */
  background:
    radial-gradient(900px 600px at 5% -10%, rgba(30, 136, 208, .30), transparent 60%),
    radial-gradient(700px 500px at 100% 5%, rgba(99, 102, 241, .22), transparent 60%),
    radial-gradient(700px 600px at 85% 85%, rgba(14, 165, 233, .20), transparent 60%),
    radial-gradient(600px 500px at 10% 95%, rgba(56, 189, 248, .16), transparent 60%),
    linear-gradient(180deg, #eef3f9, #e8eef7);
  background-attachment: fixed;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; line-height: 1.25; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 .75rem; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .85em; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Top bar ---------- */
/* Liquid glass: translucent, blurred, with a specular rim and soft depth. */
.topbar {
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  padding: .55rem .75rem .55rem 1rem; color: var(--text);
  position: sticky; top: 12px; z-index: 10;
  max-width: 1280px; margin: 12px auto 0; width: calc(100% - 24px);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .62) 0%, rgba(255, 255, 255, .34) 100%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .7);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .9),
    inset 0 -1px 0 rgba(255, 255, 255, .25),
    inset 0 0 18px rgba(255, 255, 255, .35),
    0 10px 30px rgba(15, 23, 42, .10),
    0 2px 6px rgba(15, 23, 42, .06);
}
.topbar::before {
  /* Glossy highlight across the top half. */
  content: ""; position: absolute; inset: 1px 1px 50% 1px; border-radius: 21px 21px 40% 40% / 21px 21px 14px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.topbar > * { position: relative; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar { background: rgba(255, 255, 255, .92); }
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.logo { display: block; width: 36px; height: 36px; border-radius: 50%; background: #fff; object-fit: cover; flex: none; }
.logo-lg { width: 96px; height: 96px; margin: 0 auto; }
/* Top bar: the NETPRO wordmark cropped out of the round logo image. */
.logo-wordmark {
  /* Transparent cut-out of the wordmark (379x60), sits straight on the glass. */
  display: block; width: 133px; height: 21px; flex: none; margin-left: .25rem;
  background: url("/static/logo-wordmark.png") no-repeat center / contain;
}
.mainnav { display: flex; gap: .25rem; flex-wrap: wrap; padding: 3px; border-radius: 99px; background: rgba(255, 255, 255, .25); box-shadow: inset 0 1px 2px rgba(15, 23, 42, .06); }
.mainnav a { color: #334155; padding: .4rem .9rem; border-radius: 99px; font-weight: 500; transition: background .15s, box-shadow .15s; }
.mainnav a:hover { background: rgba(255, 255, 255, .5); color: var(--text); text-decoration: none; }
.mainnav a.active {
  color: var(--text); font-weight: 600;
  background: linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, .6));
  box-shadow: inset 0 1px 0 #fff, 0 1px 3px rgba(15, 23, 42, .12), 0 0 0 1px rgba(255, 255, 255, .6);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.topbar .btn { border-radius: 99px; }
.topbar .btn-primary {
  background: linear-gradient(180deg, #3b82f6, #1d4ed8); border-color: rgba(255, 255, 255, .35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 4px 12px rgba(29, 78, 216, .3);
}
.topbar .btn-ghost {
  color: #334155; border-color: rgba(255, 255, 255, .7); background: rgba(255, 255, 255, .35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
}
.topbar .btn-ghost:hover { background: rgba(255, 255, 255, .65); color: var(--text); }
.userchip { display: flex; align-items: center; gap: .5rem; color: var(--text); }
.userchip:hover { text-decoration: none; }
.userchip-text { display: flex; flex-direction: column; line-height: 1.15; font-size: .85rem; font-weight: 600; }
.userchip-text small { color: var(--muted); font-size: .72rem; font-weight: 400; }
.avatar {
  display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: #dbeafe; color: var(--primary); font-weight: 700; font-size: .85rem;
}

/* ---------- Layout ---------- */
.container { max-width: 1280px; margin: 0 auto; padding: 1.5rem; }
.narrow { max-width: 640px; margin: 0 auto; }
.narrow.wide { max-width: 820px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.count { font-size: .9rem; color: var(--muted); font-weight: 500; background: var(--surface); border: 1px solid var(--border); padding: .05rem .5rem; border-radius: 99px; vertical-align: middle; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card.flush { padding: 0; overflow: hidden; }
.card.empty { text-align: center; padding: 2.5rem 1.25rem; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > label { flex: 1 1 180px; }
.actions { display: flex; gap: .5rem; }
.back { display: inline-block; margin-bottom: .5rem; font-size: .9rem; }

.with-sidebar { display: grid; grid-template-columns: 210px 1fr; gap: 1.5rem; align-items: start; }
.sidebar { position: sticky; top: 96px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar a { color: var(--text); padding: .45rem .75rem; border-radius: 6px; }
.sidebar a:hover { background: #e2e8f0; text-decoration: none; }
.sidebar a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.content { min-width: 0; }

/* ---------- Forms ---------- */
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .88rem; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=search], input:not([type]), select, textarea {
  font: inherit; font-weight: 400; color: var(--text); background: #fff;
  border: 1px solid #cbd5e1; border-radius: 7px; padding: .5rem .65rem; width: 100%;
}
textarea { resize: vertical; min-height: 6rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid #93c5fd; outline-offset: 0; border-color: var(--primary); }
input[type=file] { font-size: .85rem; font-weight: 400; max-width: 100%; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  font: inherit; font-weight: 600; font-size: .88rem; line-height: 1.2;
  padding: .55rem .95rem; border-radius: 7px; cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid #cbd5e1;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { background: transparent; }
.btn-sm { padding: .35rem .65rem; font-size: .8rem; }
.btn-block { width: 100%; }
form.inline { display: inline; margin-left: .5rem; }

.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters input[type=search] { flex: 1 1 240px; width: auto; }
.filters select { width: auto; }

/* ---------- Flash ---------- */
.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.flash-success { background: var(--success-soft); border-color: #bbf7d0; color: var(--success); }
.flash-error { background: var(--danger-soft); border-color: #fecaca; color: var(--danger); }
.flash-warning { background: var(--warning-soft); border-color: #fde68a; color: var(--warning); }
.flash code { background: #fff; padding: .1rem .35rem; border-radius: 4px; color: var(--text); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .65rem .9rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); font-weight: 600; }
.table tbody tr:last-child td { border-bottom: none; }
.table th.num, .table td.num { text-align: right; }
.table th.center, .table td.center { text-align: center; }
.tickets tr.rowlink { cursor: pointer; }
.tickets tr.rowlink:hover td { background: var(--surface-2); }
.tickets .subject a { color: var(--text); font-weight: 600; }
.tickets .subject { max-width: 420px; }
tr.inactive td { color: var(--muted); }
.table-scroll { overflow-x: auto; }
.tag { display: inline-block; margin-left: .4rem; font-size: .72rem; padding: .05rem .45rem; border-radius: 4px; background: #f1f5f9; color: var(--muted); font-weight: 500; vertical-align: middle; }

/* ---------- Badges ---------- */
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: .15rem .55rem; border-radius: 99px; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.status-new { background: #fef3c7; color: #92400e; }
.status-open { background: #fee2e2; color: #991b1b; }
.status-pending { background: #dbeafe; color: #1e40af; }
.status-on_hold { background: #e5e7eb; color: #374151; }
.status-solved { background: #dcfce7; color: #166534; }
.status-closed { background: #f1f5f9; color: #64748b; }
.badge-internal { background: #fde68a; color: #78350f; margin-left: .35rem; }
.prio { font-size: .82rem; font-weight: 600; white-space: nowrap; }
.prio::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .35rem; vertical-align: middle; }
.prio-low::before { background: #94a3b8; }
.prio-normal::before { background: #3b82f6; }
.prio-high::before { background: #f97316; }
.prio-urgent { color: var(--danger); }
.prio-urgent::before { background: #dc2626; }
.role { font-size: .8rem; font-weight: 600; padding: .1rem .5rem; border-radius: 5px; background: #f1f5f9; }
.role-admin { background: #ede9fe; color: #5b21b6; }
.role-supervisor { background: #dbeafe; color: #1e40af; }
.role-agent { background: #dcfce7; color: #166534; }

/* ---------- Dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; box-shadow: var(--shadow); display: flex; flex-direction: column; color: var(--text); }
a.stat:hover { border-color: #93c5fd; text-decoration: none; }
.stat-n { font-size: 1.9rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-l { color: var(--muted); font-size: .85rem; }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.bars li { display: grid; grid-template-columns: 110px 1fr 36px; align-items: center; gap: .75rem; }
.bar-label:hover { text-decoration: none; }
.bar { height: 10px; background: #f1f5f9; border-radius: 99px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 99px; min-width: 2px; }
.status-fill-new { background: #f59e0b; } .status-fill-open { background: #ef4444; } .status-fill-pending { background: #3b82f6; }
.status-fill-on_hold { background: #6b7280; } .status-fill-solved { background: #22c55e; } .status-fill-closed { background: #cbd5e1; }
.prio-fill-low { background: #94a3b8; } .prio-fill-normal { background: #3b82f6; } .prio-fill-high { background: #f97316; } .prio-fill-urgent { background: #dc2626; }
.bar-n { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--border); }
.recent li:last-child { border-bottom: none; }
.recent li > a { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-meta { display: flex; gap: .5rem; align-items: center; white-space: nowrap; font-size: .82rem; color: var(--muted); }

/* ---------- Ticket page ---------- */
.ticket-head { margin-bottom: 1.25rem; }
.ticket-meta { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; font-size: .9rem; margin-top: .4rem; }
.ticket-layout { display: grid; grid-template-columns: 1fr 300px; gap: 1.5rem; align-items: start; }
.conversation { min-width: 0; }
.comment { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.comment.staff { border-left: 3px solid var(--primary); }
.comment.internal { background: var(--internal); border-color: var(--internal-border); border-left: 3px solid #f59e0b; }
.comment header { display: flex; gap: .75rem; align-items: flex-start; margin-bottom: .6rem; }
.comment .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.files { list-style: none; margin: .75rem 0 0; padding: .6rem 0 0; border-top: 1px dashed var(--border); display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; }
.event { font-size: .82rem; color: var(--muted); margin: -.25rem 0 1rem .6rem; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.event .dot { width: 7px; height: 7px; border-radius: 50%; background: #cbd5e1; }
.event strong { color: var(--text); font-weight: 600; }
.reply textarea { border-radius: 7px; }
.reply.internal { background: var(--internal); border-color: var(--internal-border); }
.reply-tabs { display: flex; gap: 1.25rem; margin-bottom: .6rem; }
.reply-tabs label { flex-direction: row; align-items: center; gap: .4rem; cursor: pointer; }
.reply-hint { margin: .4rem 0 .75rem; }
.reply-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.submit-group { display: flex; align-items: center; gap: .6rem; margin-left: auto; }
.inline-label { flex-direction: row; align-items: center; gap: .5rem; font-weight: 500; white-space: nowrap; }
.inline-label select { width: auto; }
.closed-note { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; background: #f8fafc; }
.ticket-side .card { padding: 1rem 1.1rem; }
.props { display: grid; grid-template-columns: 90px 1fr; gap: .45rem .75rem; margin: 0 0 .75rem; font-size: .9rem; }
.props dt { color: var(--muted); }
.props dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Roles matrix ---------- */
.matrix td:first-child { min-width: 300px; }
.matrix th:not(:first-child) { min-width: 110px; }
.matrix .group-row td { background: var(--surface-2); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.matrix-foot { padding: 1rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; background: var(--surface-2); }
.role-list { list-style: none; margin: 0; padding: 0; }
.role-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.role-list li:last-child { border-bottom: none; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: linear-gradient(160deg, #0f172a 0%, #1e3a8a 100%); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 14px; padding: 2rem; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.auth-brand { text-align: center; margin-bottom: 1.5rem; }
.auth-brand h1 { margin-top: .75rem; }
.auth-brand p { margin: 0; }
.auth-card .card.empty { box-shadow: none; border: none; padding: 0; }

.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1rem 0; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .ticket-layout { grid-template-columns: 1fr; }
  .ticket-side { order: -1; }
}
@media (max-width: 760px) {
  .container { padding: 1rem; }
  .topbar { padding: .6rem 1rem; gap: .75rem; }
  .topbar-right { margin-left: 0; width: 100%; justify-content: space-between; }
  .userchip-text { display: none; }
  .with-sidebar { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .tickets th:nth-child(3), .tickets td:nth-child(3),
  .tickets th:nth-child(4), .tickets td:nth-child(4),
  .tickets th:nth-child(7), .tickets td:nth-child(7) { display: none; }
  .bars li { grid-template-columns: 90px 1fr 30px; }
}

/* =====================================================================
   Liquid glass theme — applied to every surface on every page.
   (Overrides the plain styles above; layout rules are unchanged.)
   ===================================================================== */
:root {
  --glass-bg: linear-gradient(145deg, rgba(255, 255, 255, .72) 0%, rgba(255, 255, 255, .48) 100%);
  --glass-bg-strong: linear-gradient(145deg, rgba(255, 255, 255, .86) 0%, rgba(255, 255, 255, .64) 100%);
  --glass-blur: blur(20px) saturate(170%);
  --glass-border: rgba(255, 255, 255, .75);
  --glass-line: rgba(15, 23, 42, .07);
  --glass-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .95),
    inset 0 0 20px rgba(255, 255, 255, .30),
    0 8px 28px rgba(15, 23, 42, .08),
    0 1px 3px rgba(15, 23, 42, .05);
  --radius: 18px;
  --border: rgba(15, 23, 42, .08);
  --surface-2: rgba(255, 255, 255, .45);
}

/* Shared glass surface */
.card, .stat, .comment, .auth-card, .sidebar nav {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card, .stat, .comment, .auth-card, .sidebar nav { background: rgba(255, 255, 255, .92); }
}

/* Cards */
.card.flush { overflow: hidden; }
.card.empty { background: var(--glass-bg); }
a.stat { transition: transform .15s, box-shadow .15s; }
a.stat:hover {
  border-color: rgba(255, 255, 255, .95); transform: translateY(-2px);
  box-shadow: inset 0 1px 0 #fff, 0 14px 34px rgba(29, 78, 216, .14), 0 2px 6px rgba(15, 23, 42, .06);
}
.stat-n { background: linear-gradient(180deg, #0f172a, #334155); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Sidebar views */
.sidebar nav { padding: .4rem; gap: 3px; }
.sidebar a { border-radius: 12px; transition: background .15s; }
.sidebar a:hover { background: rgba(255, 255, 255, .6); }
.sidebar a.active {
  background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(255, 255, 255, .7));
  box-shadow: inset 0 1px 0 #fff, 0 1px 4px rgba(15, 23, 42, .10);
  color: var(--primary);
}

/* Tables */
.table th { background: rgba(255, 255, 255, .35); border-bottom-color: var(--glass-line); }
.table td { border-bottom-color: var(--glass-line); }
.tickets tr.rowlink { transition: background .12s; }
.tickets tr.rowlink:hover td { background: rgba(255, 255, 255, .55); }
.tag { background: rgba(255, 255, 255, .6); border: 1px solid rgba(255, 255, 255, .8); }
.count { background: rgba(255, 255, 255, .6); border-color: rgba(255, 255, 255, .85); box-shadow: inset 0 1px 0 #fff; }

/* Badges get a glossy top edge */
.badge, .role { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 0 0 1px rgba(255, 255, 255, .4); }

/* Ticket conversation */
.comment.staff { border-left: 1px solid var(--glass-border); box-shadow: var(--glass-shadow), inset 3px 0 0 var(--primary); }
.comment.internal {
  background: linear-gradient(145deg, rgba(255, 247, 214, .85), rgba(254, 240, 186, .6));
  border-color: rgba(252, 211, 77, .8);
  box-shadow: var(--glass-shadow), inset 3px 0 0 #f59e0b;
}
.reply.internal { background: linear-gradient(145deg, rgba(255, 247, 214, .88), rgba(254, 240, 186, .62)); border-color: rgba(252, 211, 77, .8); }
.closed-note { background: var(--glass-bg); }
.files { border-top-color: var(--glass-line); }
.event .dot { background: rgba(100, 116, 139, .45); box-shadow: 0 0 0 3px rgba(255, 255, 255, .7); }
.recent li, .role-list li { border-bottom-color: var(--glass-line); }
.matrix .group-row td { background: rgba(255, 255, 255, .4); }
.matrix-foot { background: rgba(255, 255, 255, .35); border-top-color: var(--glass-line); }
.bar { background: rgba(15, 23, 42, .06); box-shadow: inset 0 1px 2px rgba(15, 23, 42, .08); }
.bar-fill { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5); }

/* Form fields: frosted wells */
input[type=text], input[type=email], input[type=password], input[type=search], input:not([type]), select, textarea {
  background: rgba(255, 255, 255, .7);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, .08), 0 0 0 1px rgba(15, 23, 42, .06);
  border-radius: 12px;
}
input:focus, select:focus, textarea:focus {
  outline: none; background: rgba(255, 255, 255, .92); border-color: rgba(59, 130, 246, .6);
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, .06), 0 0 0 3px rgba(59, 130, 246, .25);
}

/* Buttons: glass pills */
.btn {
  border-radius: 99px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, .6));
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: inset 0 1px 0 #fff, 0 1px 3px rgba(15, 23, 42, .10), 0 0 0 1px rgba(15, 23, 42, .05);
  transition: background .15s, box-shadow .15s, transform .1s;
}
.btn:hover { background: linear-gradient(180deg, #fff, rgba(255, 255, 255, .8)); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  color: #fff; background: linear-gradient(180deg, #3b82f6, #1d4ed8); border-color: rgba(255, 255, 255, .35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 4px 12px rgba(29, 78, 216, .28);
}
.btn-primary:hover { background: linear-gradient(180deg, #4f8ff7, #1e40af); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: linear-gradient(180deg, #fff, rgba(254, 226, 226, .8)); }
.btn-ghost { background: rgba(255, 255, 255, .3); }

/* Flash messages */
.flash {
  border-radius: 14px; -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 4px 14px rgba(15, 23, 42, .06);
}
.flash-success { background: rgba(220, 252, 231, .75); border-color: rgba(134, 239, 172, .8); }
.flash-error { background: rgba(254, 226, 226, .75); border-color: rgba(252, 165, 165, .8); }
.flash-warning { background: rgba(254, 249, 195, .75); border-color: rgba(253, 224, 71, .8); }

/* Sign-in page: glass card over a deep blue backdrop */
.auth-wrap {
  background:
    radial-gradient(600px 400px at 20% 20%, rgba(56, 189, 248, .45), transparent 60%),
    radial-gradient(600px 500px at 85% 80%, rgba(99, 102, 241, .45), transparent 60%),
    linear-gradient(160deg, #0f172a 0%, #1e3a8a 100%);
}
.auth-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, .82), rgba(255, 255, 255, .6));
  box-shadow: inset 0 1px 0 #fff, 0 24px 60px rgba(0, 0, 0, .3);
  border-radius: 24px;
}
.auth-card .logo-lg { box-shadow: 0 6px 20px rgba(15, 23, 42, .18); }

/* ---------- Analytics ---------- */
.analytics-filters { margin-bottom: 0; }
.chart-box { position: relative; width: 100%; height: 280px; }
.chart-pie { height: 280px; }
.chart-sub { margin: -.5rem 0 .75rem; }
.stat-text { font-size: 1.35rem; line-height: 1.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .5rem; vertical-align: baseline; background: #a8a69f; }
.region-rename { display: flex; gap: .5rem; align-items: center; }
.region-rename input { max-width: 260px; }

/* ---------- Regions admin ---------- */
.region-add-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.region-add-row input { flex: 1 1 240px; width: auto; }
.region-list { display: flex; flex-direction: column; gap: .75rem; }
.region-item { margin: 0; padding: 1rem 1.25rem; }
.region-main { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.region-name { font-size: 1.05rem; }
.region-actions { display: flex; gap: .5rem; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }
.region-panel > summary { list-style: none; }
.region-panel > summary::-webkit-details-marker { display: none; }
.region-panel[open] > summary { box-shadow: inset 0 1px 3px rgba(15, 23, 42, .15); }
.region-form {
  display: flex; flex-direction: column; gap: .6rem; margin-top: .5rem; padding: .75rem;
  border-radius: 14px; background: rgba(255, 255, 255, .55); border: 1px solid rgba(255, 255, 255, .85);
  min-width: 240px;
}

/* Keep the top bar on one line when the admin menu has many items. */
.topbar { gap: 1rem; }
.mainnav a { padding: .4rem .75rem; }
@media (max-width: 1080px) and (min-width: 761px) {
  .userchip-text { display: none; }
  .mainnav a { padding: .4rem .6rem; }
  .topbar .btn-primary { padding-left: .8rem; padding-right: .8rem; }
}

/* ---------- Notifications ---------- */
.bell {
  position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  color: #334155; background: rgba(255, 255, 255, .35); border: 1px solid rgba(255, 255, 255, .7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
}
.bell:hover, .bell.active { background: rgba(255, 255, 255, .75); color: var(--text); text-decoration: none; }
.bell-count {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  background: linear-gradient(180deg, #f87171, #dc2626); color: #fff; font-size: .68rem; font-weight: 700;
  display: grid; place-items: center; box-shadow: 0 0 0 2px #fff;
}
.bell-count[hidden] { display: none; }
.push-card { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.push-text p { margin: .25rem 0 0; max-width: 520px; }
.push-actions { display: flex; gap: .5rem; }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list li + li { border-top: 1px solid var(--glass-line); }
.notif-list a { display: flex; gap: .75rem; align-items: flex-start; padding: .85rem 1.1rem; color: var(--text); }
.notif-list a:hover { background: rgba(255, 255, 255, .55); text-decoration: none; }
.notif-dot { flex: none; width: 8px; height: 8px; margin-top: .45rem; border-radius: 50%; background: transparent; }
.notif-list li.unread .notif-dot { background: var(--primary); box-shadow: 0 0 0 3px rgba(59, 130, 246, .2); }
.notif-list li:not(.unread) strong { font-weight: 500; color: var(--muted); }
.notif-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.notif-body { color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.notif-time { flex: none; color: var(--muted); font-size: .8rem; white-space: nowrap; }

/* Elements hidden with the "hidden" attribute stay hidden even if a class sets display. */
[hidden] { display: none !important; }

/* ---------- Contact Outdoor (WhatsApp) ---------- */
.btn-whatsapp {
  color: #fff; background: linear-gradient(180deg, #2fd46b, #1aa851); border-color: rgba(255, 255, 255, .35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 4px 12px rgba(26, 168, 81, .3);
}
.btn-whatsapp:hover { background: linear-gradient(180deg, #3ae077, #179646); color: #fff; }
.outdoor-preview { margin-top: .6rem; }
.outdoor-preview summary { cursor: pointer; color: var(--muted); }
.outdoor-preview pre {
  white-space: pre-wrap; overflow-wrap: anywhere; font: .78rem/1.45 var(--font); margin: .4rem 0 0;
  padding: .6rem .7rem; border-radius: 10px; background: rgba(220, 248, 198, .7); border: 1px solid rgba(255, 255, 255, .8);
  max-height: 260px; overflow: auto;
}
.region-phone { margin: .15rem 0; }
.region-add-title { display: block; margin-bottom: .5rem; }
.region-add-row { align-items: flex-end; }
.region-add-row > label { flex: 1 1 200px; }
.region-add-row > label input { width: 100%; flex: none; }
input[type=tel], input[type=url] {
  font: inherit; font-weight: 400; color: var(--text); width: 100%; padding: .5rem .65rem;
  background: rgba(255, 255, 255, .7); border: 1px solid rgba(255, 255, 255, .9); border-radius: 12px;
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, .08), 0 0 0 1px rgba(15, 23, 42, .06);
}
input[type=tel]:focus, input[type=url]:focus {
  outline: none; background: rgba(255, 255, 255, .92); border-color: rgba(59, 130, 246, .6);
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, .06), 0 0 0 3px rgba(59, 130, 246, .25);
}

/* ---------- Outdoor replies ---------- */
.badge-outdoor { background: #d1fae5; color: #065f46; margin-left: .35rem; }
.comment.outdoor {
  background: linear-gradient(145deg, rgba(220, 252, 231, .85), rgba(187, 247, 208, .55));
  border-color: rgba(134, 239, 172, .8);
  box-shadow: var(--glass-shadow), inset 3px 0 0 #16a34a;
}
.comment.outdoor .avatar { background: #bbf7d0; color: #166534; }
.outdoor-link-actions { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.outdoor-link-actions form.inline { margin: 0; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--danger); cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }

/* Public Outdoor page (opened from WhatsApp on a phone) */
.outdoor-page { min-height: 100vh; }
.outdoor-top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: 720px; margin: 12px auto 0; width: calc(100% - 24px); padding: .7rem 1rem; border-radius: 18px;
  background: var(--glass-bg); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
}
.outdoor-badge { font-size: .8rem; font-weight: 700; color: #065f46; background: #d1fae5; padding: .25rem .65rem; border-radius: 99px; }
.outdoor-main { max-width: 720px; margin: 0 auto; padding: 1rem 12px 2rem; }
.outdoor-title { margin: .1rem 0 .5rem; font-size: 1.3rem; }
.outdoor-props { margin-top: .9rem; grid-template-columns: 80px 1fr; }
.outdoor-h2 { margin: 1.25rem .25rem .75rem; }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.settings-grid > .card { margin: 0; }
.template-box { font: .88rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; min-height: 22rem; }
.settings-actions { flex-wrap: wrap; }
.placeholder-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.placeholder-list li { display: flex; flex-direction: column; gap: .1rem; }
.ph-chip {
  align-self: flex-start; font: .8rem ui-monospace, SFMono-Regular, Consolas, monospace; cursor: pointer;
  padding: .15rem .5rem; border-radius: 8px; color: #1e40af; background: rgba(219, 234, 254, .8); border: 1px solid rgba(147, 197, 253, .8);
}
.ph-chip:hover { background: #dbeafe; }
.wa-chat { background: #efeae2; border-radius: 14px; padding: 1rem; }
.wa-bubble {
  background: #d9fdd3; border-radius: 10px 10px 10px 2px; padding: .6rem .75rem; max-width: 420px;
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: .9rem; line-height: 1.45; color: #111b21;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .12);
}
.wa-link { color: #027eb5; text-decoration: underline; pointer-events: none; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }

/* ---- Delete user / role ---- */
.danger-zone { margin-top: 1.25rem; border-color: rgba(220, 38, 38, .25); }
.danger-zone h2 { color: var(--danger); margin: 0; font-size: 1.05rem; }
.role-delete { display: flex; align-items: flex-end; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.role-delete label { display: flex; flex-direction: column; gap: .2rem; margin: 0; }
.role-delete select { padding: .3rem .5rem; font-size: .85rem; min-width: 8rem; }
