/* =====================================================================
   Mentek · Proje Yönetimi — design system
   Soft structural light theme in the Mentek brand colours (red, black, white). Geist + Geist Mono (self-hosted, OFL),
   Phosphor Light icons (sprite). Loaded after Bootstrap: restyles every
   Bootstrap component the templates use, so all screens share one look.
   ===================================================================== */

@font-face {
  font-family: "Geist";
  src: url("../fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* ---------- tokens ---------- */
:root {
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --canvas: #f4f4f5;
  --canvas-2: #f4f4f5;
  --surface: #ffffff;
  --surface-2: #f8f8f9;
  --surface-3: #f0f0f2;
  --ink: #111111;
  --ink-2: #3b3b40;
  --ink-3: #6b6b73;
  --ink-4: #a1a1aa;
  --line: rgba(17, 17, 17, 0.075);
  --line-2: rgba(17, 17, 17, 0.12);

  --accent: #d71920;
  --accent-ink: #a3121a;
  --accent-soft: #fdeced;
  --accent-glow: rgba(215, 25, 32, 0.18);
  --brand-red: #e11d1d;
  --brand-red-soft: #fdecec;
  --sand: var(--brand-red);
  --sand-soft: var(--brand-red-soft);

  --ok: #1c7c4f;
  --ok-soft: #e3f3ea;
  --warn: #9a6408;
  --warn-soft: #fbf0d9;
  --danger: #9f1d1d;
  --danger-soft: #fbe7e3;
  --info: #3b6fae;
  --info-soft: #e9f0fa;

  --r-xl: 28px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;

  --shadow-1: 0 1px 2px rgba(17, 17, 17, 0.04), 0 1px 1px rgba(17, 17, 17, 0.02);
  --shadow-2: 0 1px 2px rgba(17, 17, 17, 0.04), 0 18px 40px -18px rgba(17, 17, 17, 0.16);
  --shadow-3: 0 2px 4px rgba(17, 17, 17, 0.04), 0 32px 64px -24px rgba(17, 17, 17, 0.22);
  --highlight: inset 0 1px 0 rgba(255, 255, 255, 0.9);

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-spring: cubic-bezier(0.34, 1.32, 0.64, 1);

  --sidebar-w: 284px;
  --gutter: 18px;

  /* Bootstrap bridge */
  --bs-body-font-family: var(--font);
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--canvas);
  --bs-border-color: var(--line);
  --bs-link-color: var(--accent);
  --bs-link-color-rgb: 215, 25, 32;
  --bs-link-hover-color: var(--accent-ink);
  --bs-link-hover-color-rgb: 163, 18, 26;
  --bs-primary: var(--accent);
  --bs-primary-rgb: 215, 25, 32;
  --bs-secondary-color: var(--ink-3);
  --bs-emphasis-color: var(--ink);
  --bs-focus-ring-color: var(--accent-glow);
}

/* ---------- base ---------- */
html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  letter-spacing: -0.006em;
  color: var(--ink);
  background: var(--canvas);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
}

/* ambient light: fixed, never scrolls (no repaint cost) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1100px 620px at 92% -8%, rgba(215, 25, 32, 0.05), transparent 62%),
    radial-gradient(900px 520px at -6% 108%, rgba(17, 17, 17, 0.03), transparent 60%),
    linear-gradient(180deg, #f9f9fa 0%, var(--canvas) 48%, var(--canvas-2) 100%);
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
  color: var(--ink);
  letter-spacing: -0.022em;
  font-weight: 600;
}

h1.h4, .h4:is(h1) {
  font-size: clamp(1.45rem, 1.1rem + 0.9vw, 1.9rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

h2.h6, .h6 {
  font-size: 0.95rem;
  letter-spacing: -0.012em;
}

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

a:hover {
  color: var(--accent-ink);
}

code, kbd, .font-monospace {
  font-family: var(--mono);
  font-size: 0.86em;
  color: var(--ink-2);
  background: var(--surface-3);
  border-radius: 6px;
  padding: 0.12em 0.42em;
}

.text-muted, .form-text {
  color: var(--ink-3) !important;
}

::selection {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

/* tabular numbers everywhere numbers line up */
td, .badge, .kpi-value, .page-link, dd {
  font-variant-numeric: tabular-nums;
}

/* ---------- icons ---------- */
.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: currentColor;
  vertical-align: -0.24em;
}

.icon-lg {
  width: 1.6em;
  height: 1.6em;
}

/* ---------- application shell ---------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100dvh;
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: var(--gutter) 0 var(--gutter) var(--gutter);
  z-index: 30;
}

/* double bezel: aluminium tray + glass plate */
.sidebar-shell {
  height: 100%;
  padding: 6px;
  border-radius: var(--r-xl);
  background: rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-2);
}

.sidebar-core {
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: calc(var(--r-xl) - 6px);
  background: var(--surface);
  box-shadow: var(--highlight), 0 0 0 1px var(--line);
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  padding: 26px 22px 18px;
}

.brand-logo {
  display: block;
  width: auto;
  height: 34px;
  transition: transform 0.6s var(--ease-spring);
}

.brand:hover .brand-logo {
  transform: translateY(-1px) scale(1.015);
}

.eyebrow {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-4);
}

.eyebrow-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(215, 25, 32, 0.14);
}

/* the menu scrolls without a visible scrollbar (a Windows scrollbar cut into the panel edge);
   soft fades at the top and bottom show that there is more */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px 16px;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 14px, #000 calc(100% - 22px), transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 14px, #000 calc(100% - 22px), transparent 100%);
}

.sidebar-nav::-webkit-scrollbar {
  display: none;
}

.nav-section {
  margin-top: 16px;
}

.nav-section > .eyebrow {
  display: block;
  padding: 0 10px 6px;
}

.nav-link-app {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  margin: 1px 0;
  border-radius: 11px;
  color: var(--ink-2);
  font-weight: 500;
  font-size: 14px;
  transition: background 0.45s var(--ease), color 0.45s var(--ease), transform 0.45s var(--ease);
}

.nav-link-app .icon {
  width: 19px;
  height: 19px;
  color: var(--ink-3);
  transition: color 0.45s var(--ease), transform 0.5s var(--ease-spring);
}

.nav-link-app:hover {
  color: var(--ink);
  background: var(--surface-3);
}

.nav-link-app:hover .icon {
  color: var(--ink);
  transform: translateX(1px) scale(1.06);
}

.nav-link-app.is-active {
  color: var(--accent-ink);
  background: var(--accent-soft);
}

.nav-link-app.is-active .icon {
  color: var(--accent);
}

.nav-link-app.is-active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand-red);
}

.nav-link-app.is-soon {
  color: var(--ink-3);
}


.sidebar-user {
  border-top: 1px solid var(--line);
  padding: 12px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px;
  border-radius: var(--r-md);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--accent-ink);
  background: linear-gradient(160deg, #eef3fb, #d9e4f5);
  box-shadow: inset 0 0 0 1px rgba(215, 25, 32, 0.16);
}

.user-meta {
  min-width: 0;
  flex: 1;
  line-height: 1.2;
}

.user-name {
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-sub {
  font-size: 12px;
  color: var(--ink-3);
}

.user-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  color: var(--ink-2);
  background: transparent;
  transition: background 0.4s var(--ease), color 0.4s var(--ease), transform 0.3s var(--ease);
}

.icon-btn:hover {
  color: var(--ink);
  background: var(--surface-3);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn .icon {
  width: 20px;
  height: 20px;
}

.user-actions .icon-btn {
  flex: 1;
  width: auto;
  height: 34px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* ---------- main column ---------- */
.app-main {
  min-width: 0;
  padding: var(--gutter) var(--gutter) 48px;
}

/* the top bar exists only on small screens (menu button + logo) */
.app-topbar {
  display: none;
  position: sticky;
  top: var(--gutter);
  z-index: 20;
  align-items: center;
  gap: 14px;
  padding: 8px 8px 8px 18px;
  margin-bottom: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-1);
}

.topbar-brand {
  display: flex;
  align-items: center;
}

.topbar-brand img {
  display: block;
  height: 24px;
  width: auto;
}

/* unread notifications: small red count on the sidebar entry */
.nav-count:empty {
  display: none;
}

.nav-count {
  margin-left: auto;
}

.nav-badge {
  display: inline-block;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  color: #fff;
  background: var(--brand-red);
  box-shadow: 0 4px 10px -4px rgba(226, 35, 26, 0.6);
}

.menu-toggle {
  display: none;
}

/* mobile drawer backdrop: only exists below the desktop breakpoint */
.nav-backdrop {
  display: none;
}

.app-content {
  max-width: 1440px;
  margin: 0 auto;
}

/* page entry: heavy, soft fade-up */
.app-content > div > * {
  animation: rise 0.9s var(--ease) both;
}

.app-content > div > *:nth-child(2) { animation-delay: 0.05s; }
.app-content > div > *:nth-child(3) { animation-delay: 0.1s; }
.app-content > div > *:nth-child(4) { animation-delay: 0.15s; }
.app-content > div > *:nth-child(5) { animation-delay: 0.2s; }
.app-content > div > *:nth-child(n + 6) { animation-delay: 0.25s; }

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

/* page header row used by most list screens */
.app-content .d-flex.justify-content-between.align-items-center.mb-3 {
  margin-bottom: 22px !important;
  gap: 16px;
  flex-wrap: wrap;
}

.app-content h1.h4 {
  margin-bottom: 26px;
}

.app-content .d-flex h1.h4 {
  margin-bottom: 0 !important;
}

/* ---------- buttons: pills with physical press ---------- */
.btn {
  --bs-btn-padding-x: 1.05rem;
  --bs-btn-padding-y: 0.56rem;
  --bs-btn-font-weight: 550;
  --bs-btn-font-size: 0.875rem;
  --bs-btn-border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: -0.005em;
  transition: transform 0.35s var(--ease), box-shadow 0.45s var(--ease), background-color 0.45s var(--ease),
    color 0.45s var(--ease), border-color 0.45s var(--ease);
}

.btn:active {
  transform: scale(0.97);
}

.btn-sm {
  --bs-btn-padding-x: 0.85rem;
  --bs-btn-padding-y: 0.36rem;
  --bs-btn-font-size: 0.8125rem;
}

.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--ink);
  --bs-btn-border-color: var(--ink);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #2a2a2a;
  --bs-btn-hover-border-color: #2a2a2a;
  --bs-btn-active-bg: #000000;
  --bs-btn-active-border-color: #000000;
  --bs-btn-disabled-bg: var(--ink-4);
  --bs-btn-disabled-border-color: var(--ink-4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 10px 22px -12px rgba(17, 17, 17, 0.65);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 16px 28px -14px rgba(17, 17, 17, 0.7);
}

/* trailing "button-in-button" arrow for primary actions */
.btn-primary::after {
  content: "";
  width: 22px;
  height: 22px;
  margin-right: -0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%23fff'%3E%3Cpath d='M196 64v104a6 6 0 0 1-12 0V78.49L68.24 194.24a6 6 0 0 1-8.48-8.48L175.51 70H88a6 6 0 0 1 0-12h104a6 6 0 0 1 6 6Z'/%3E%3C/svg%3E")
    center / 12px no-repeat;
  transition: transform 0.5s var(--ease-spring), background-color 0.4s var(--ease);
}

.btn-primary:hover::after {
  transform: translate(2px, -1px) scale(1.06);
  background-color: rgba(255, 255, 255, 0.22);
}

.btn-sm.btn-primary::after {
  width: 18px;
  height: 18px;
  margin-right: -0.45rem;
  background-size: 10px;
}

.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-success,
.btn-outline-warning,
.btn-outline-danger,
.btn-secondary,
.btn-light {
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: transparent;
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-border-color: transparent;
  box-shadow: 0 0 0 1px var(--line-2), var(--shadow-1);
}

.btn-outline-primary,
.btn-outline-secondary,
.btn-secondary,
.btn-light {
  --bs-btn-color: var(--ink);
  --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-bg: var(--surface-2);
  --bs-btn-active-color: var(--ink);
  --bs-btn-active-bg: var(--surface-3);
}

.btn-outline-success {
  --bs-btn-color: var(--ok);
  --bs-btn-hover-color: var(--ok);
  --bs-btn-hover-bg: var(--ok-soft);
  --bs-btn-active-color: var(--ok);
  --bs-btn-active-bg: var(--ok-soft);
}

.btn-outline-warning {
  --bs-btn-color: var(--warn);
  --bs-btn-hover-color: var(--warn);
  --bs-btn-hover-bg: var(--warn-soft);
  --bs-btn-active-color: var(--warn);
  --bs-btn-active-bg: var(--warn-soft);
}

.btn-outline-danger,
.btn-danger {
  --bs-btn-color: var(--danger);
  --bs-btn-hover-color: var(--danger);
  --bs-btn-hover-bg: var(--danger-soft);
  --bs-btn-active-color: var(--danger);
  --bs-btn-active-bg: var(--danger-soft);
}

.btn-danger {
  --bs-btn-bg: var(--danger-soft);
  --bs-btn-border-color: transparent;
}

.btn-success {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--ink);
  --bs-btn-border-color: var(--ink);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--accent-ink);
  --bs-btn-hover-border-color: var(--accent-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 10px 22px -12px rgba(215, 25, 32, 0.7);
}

.btn-link {
  --bs-btn-color: var(--accent);
  --bs-btn-hover-color: var(--accent-ink);
  --bs-btn-padding-x: 0.25rem;
  text-decoration: none;
  font-weight: 550;
}

.btn-link.text-danger {
  color: var(--danger) !important;
}

.btn:disabled,
.btn.disabled {
  opacity: 0.45;
  box-shadow: none;
}

/* ---------- forms ---------- */
.form-label,
.form-check-label,
legend {
  font-size: 13px;
  font-weight: 550;
  color: var(--ink-2);
  margin-bottom: 6px;
}

legend.h6 {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-4) !important;
  margin-bottom: 10px;
}

.form-control,
.form-select {
  min-height: 44px;
  padding: 0.6rem 0.9rem;
  font-size: 14.5px;
  color: var(--ink);
  background-color: var(--surface);
  border: 0;
  border-radius: var(--r-sm);
  box-shadow: 0 0 0 1px var(--line-2), inset 0 1px 2px rgba(17, 17, 17, 0.04);
  transition: box-shadow 0.4s var(--ease), background-color 0.4s var(--ease);
}

.form-control::placeholder {
  color: var(--ink-4);
}

.form-control:hover,
.form-select:hover {
  box-shadow: 0 0 0 1px rgba(17, 17, 17, 0.22), inset 0 1px 2px rgba(17, 17, 17, 0.04);
}

.form-control:focus,
.form-select:focus {
  background-color: var(--surface);
  box-shadow: 0 0 0 1px var(--accent), 0 0 0 5px var(--accent-glow);
}

.form-control[readonly],
.form-control:disabled,
.form-select:disabled {
  color: var(--ink-3);
  background-color: var(--surface-3);
  box-shadow: 0 0 0 1px var(--line);
}

.form-control-sm,
.form-select-sm {
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  font-size: 13.5px;
  border-radius: 10px;
}

.form-select {
  padding-right: 2.4rem;
  background-position: right 0.8rem center;
}

textarea.form-control {
  min-height: 96px;
}

input[type="file"].form-control {
  padding: 0.5rem 0.6rem;
}

input[type="file"].form-control::file-selector-button {
  margin: -0.15rem 0.75rem -0.15rem 0;
  padding: 0.4rem 0.9rem;
  border: 0;
  border-radius: 999px;
  color: var(--ink);
  background: var(--surface-3);
}

.form-check-input {
  width: 1.1em;
  height: 1.1em;
  border-color: var(--line-2);
  box-shadow: none;
}

.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

.form-check-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.text-danger.small,
.invalid-feedback {
  display: block;
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--danger) !important;
}

.text-danger.small:empty {
  display: none;
}

/* a form on its own reads as a panel */
.app-content form.row.g-3,
.app-content form.app-form {
  max-width: 880px;
  padding: 26px;
  margin-left: 0;
  margin-right: 0;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), 0 0 0 6px rgba(255, 255, 255, 0.5), 0 0 0 7px var(--line), var(--shadow-2);
}

.app-content form.row.g-3 > * {
  padding-left: 10px;
  padding-right: 10px;
}

/* filter bars */
.app-content form[method="get"].row,
.app-content form[method="get"].d-flex {
  padding: 10px;
  margin-left: 0;
  margin-right: 0;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 0 1px var(--line);
}

.app-content form[method="get"].row > * {
  padding-left: 5px;
  padding-right: 5px;
}

/* ---------- tables: floating sheets ---------- */
.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--ink);
  --bs-table-hover-bg: var(--surface-2);
  --bs-table-striped-bg: var(--surface-2);
  margin-bottom: 1.25rem;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--line), var(--shadow-2);
}

.table > :not(caption) > * > * {
  padding: 0.82rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table-sm > :not(caption) > * > * {
  padding: 0.68rem 0.95rem;
}

.table > thead > tr > th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--surface-2);
  white-space: nowrap;
}

.table > thead > tr > th a {
  color: var(--ink-3);
}

.table > thead > tr > th a:hover {
  color: var(--ink);
}

.table > tbody > tr {
  transition: background-color 0.35s var(--ease);
}

.table > tbody > tr:hover > * {
  background: var(--surface-2);
}

.table > tbody > tr:last-child > * {
  border-bottom: 0;
}

.table > tfoot > tr > * {
  font-weight: 600;
  background: var(--surface-2);
}

.table td a {
  font-weight: 550;
}

.table-responsive,
.table-scroll {
  border-radius: var(--r-lg);
  margin-bottom: 1.25rem;
}

.table-responsive > .table,
.table-scroll > .table {
  margin-bottom: 0;
}

/* wide matrices (monthly timesheet) scroll inside the page */
.app-content {
  overflow-x: clip;
}

/* a matrix without its own scroll container still scrolls sideways */
.app-content :not(.table-responsive) > .table-matrix {
  display: block;
  overflow-x: auto;
  max-width: 100%;
  white-space: nowrap;
}

.table-matrix td,
.table-matrix th {
  text-align: center;
  white-space: nowrap;
}

.table-matrix td:first-child,
.table-matrix th:first-child {
  text-align: left;
}

/* ---------- badges: soft tinted pills ---------- */
.badge {
  --bs-badge-padding-x: 0.62em;
  --bs-badge-padding-y: 0.36em;
  --bs-badge-font-weight: 600;
  --bs-badge-border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: 0.01em;
  vertical-align: 0.08em;
}

.text-bg-success { color: var(--ok) !important; background: var(--ok-soft) !important; }
.text-bg-warning { color: var(--warn) !important; background: var(--warn-soft) !important; }
.text-bg-danger { color: var(--danger) !important; background: var(--danger-soft) !important; }
.text-bg-info, .text-bg-primary { color: var(--info) !important; background: var(--info-soft) !important; }
.text-bg-secondary, .text-bg-light { color: var(--ink-2) !important; background: var(--surface-3) !important; }
.text-bg-dark { color: #fff !important; background: var(--ink) !important; }

.text-success { color: var(--ok) !important; }
.text-warning, .text-warning-emphasis { color: var(--warn) !important; }
.text-danger { color: var(--danger) !important; }

/* ---------- alerts ---------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border: 0;
  border-radius: var(--r-md);
  font-size: 14px;
  box-shadow: inset 0 0 0 1px rgba(17, 17, 17, 0.06);
  --bs-alert-margin-bottom: 1.1rem;
}

.alert::before {
  content: "";
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 1px;
  background: currentColor;
  -webkit-mask: var(--alert-icon) center / contain no-repeat;
  mask: var(--alert-icon) center / contain no-repeat;
}

.alert > * {
  color: var(--ink);
}

.alert-success {
  color: var(--ok);
  background: var(--ok-soft);
  --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M172.24 99.76a6 6 0 0 1 0 8.48l-56 56a6 6 0 0 1-8.48 0l-24-24a6 6 0 0 1 8.48-8.48L112 151.51l51.76-51.75a6 6 0 0 1 8.48 0ZM230 128A102 102 0 1 1 128 26a102.12 102.12 0 0 1 102 102Zm-12 0a90 90 0 1 0-90 90 90.1 90.1 0 0 0 90-90Z'/%3E%3C/svg%3E");
}

.alert-danger {
  color: var(--danger);
  background: var(--danger-soft);
  --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M128 26a102 102 0 1 0 102 102A102.12 102.12 0 0 0 128 26Zm0 192a90 90 0 1 1 90-90 90.1 90.1 0 0 1-90 90Zm-6-82V80a6 6 0 0 1 12 0v56a6 6 0 0 1-12 0Zm16 36a10 10 0 1 1-10-10 10 10 0 0 1 10 10Z'/%3E%3C/svg%3E");
}

.alert-warning {
  color: var(--warn);
  background: var(--warn-soft);
  --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M235.07 189.09 147.61 37.22a22.75 22.75 0 0 0-39.22 0L20.93 189.09a21.53 21.53 0 0 0 0 21.72A22.35 22.35 0 0 0 40.55 222h174.9a22.35 22.35 0 0 0 19.6-11.19 21.53 21.53 0 0 0 .02-21.72ZM224.66 204.8a10.46 10.46 0 0 1-9.21 5.2H40.55a10.46 10.46 0 0 1-9.21-5.2 9.51 9.51 0 0 1 0-9.72L118.79 43.21a10.75 10.75 0 0 1 18.42 0l87.46 151.87a9.51 9.51 0 0 1-.01 9.72ZM122 144v-40a6 6 0 0 1 12 0v40a6 6 0 0 1-12 0Zm16 36a10 10 0 1 1-10-10 10 10 0 0 1 10 10Z'/%3E%3C/svg%3E");
}

.alert-info,
.alert-secondary,
.alert-light {
  color: var(--info);
  background: var(--info-soft);
  --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M142 176a6 6 0 0 1-6 6 14 14 0 0 1-14-14v-40a2 2 0 0 0-2-2 6 6 0 0 1 0-12 14 14 0 0 1 14 14v40a2 2 0 0 0 2 2 6 6 0 0 1 6 6Zm-18-82a10 10 0 1 0-10-10 10 10 0 0 0 10 10Zm106 34A102 102 0 1 1 128 26a102.12 102.12 0 0 1 102 102Zm-12 0a90 90 0 1 0-90 90 90.1 90.1 0 0 0 90-90Z'/%3E%3C/svg%3E");
}

.alert {
  color: var(--ink);
}

.alert.alert-success,
.alert.alert-danger,
.alert.alert-warning,
.alert.alert-info {
  color: inherit;
}

.alert-success { color: #0f4d31 !important; }
.alert-danger { color: #7d2a1d !important; }
.alert-warning { color: #6b4504 !important; }
.alert-info { color: #1d4268 !important; }

/* ---------- cards: double bezel ---------- */
.card {
  --bs-card-border-width: 0;
  --bs-card-bg: var(--surface);
  --bs-card-border-radius: var(--r-lg);
  --bs-card-spacer-y: 1.25rem;
  --bs-card-spacer-x: 1.35rem;
  color: var(--ink);
  border-radius: var(--r-lg);
  box-shadow: 0 0 0 1px var(--line), 0 0 0 6px rgba(255, 255, 255, 0.55), 0 0 0 7px var(--line), var(--shadow-2);
  transition: transform 0.6s var(--ease), box-shadow 0.6s var(--ease);
}

a.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 0 1px rgba(215, 25, 32, 0.25), 0 0 0 6px rgba(255, 255, 255, 0.7), 0 0 0 7px rgba(215, 25, 32, 0.18),
    var(--shadow-3);
}

.card-title {
  letter-spacing: -0.015em;
}

.row.g-3 > .col-md-4 > .card,
.row.g-3 > [class*="col"] > .card {
  margin: 7px;
}

/* ---------- lists ---------- */
.list-group {
  --bs-list-group-border-color: var(--line);
  --bs-list-group-bg: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-2);
  overflow: hidden;
}

.list-group-item {
  padding: 0.85rem 1.1rem;
  border-left: 0;
  border-right: 0;
}

.list-group-item:first-child {
  border-top: 0;
}

/* ---------- definition lists (detail screens) ---------- */
dl.row {
  padding: 18px 22px;
  margin-left: 0;
  margin-right: 0;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-1);
}

dl.row > dt {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-3);
  padding-top: 6px;
  padding-bottom: 6px;
}

dl.row > dd {
  font-weight: 500;
  padding-top: 6px;
  padding-bottom: 6px;
  margin-bottom: 0;
}

/* ---------- tabs: segmented control ---------- */
.nav-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 4px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 0 0 1px var(--line);
}

.nav-tabs .nav-link {
  margin: 0;
  padding: 0.42rem 0.95rem;
  border: 0;
  border-radius: 999px;
  color: var(--ink-3);
  font-weight: 550;
  font-size: 13.5px;
  transition: background 0.45s var(--ease), color 0.45s var(--ease), box-shadow 0.45s var(--ease);
}

.nav-tabs .nav-link:hover {
  color: var(--ink);
  background: var(--surface-3);
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-1);
}

/* ---------- pagination ---------- */
.pagination {
  --bs-pagination-border-width: 0;
  gap: 6px;
  align-items: center;
}

.page-link {
  border-radius: 999px !important;
  color: var(--ink-2);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
  padding: 0.4rem 0.95rem;
  font-size: 13px;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}

.page-link:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.page-item.disabled .page-link {
  color: var(--ink-4);
  background: transparent;
  box-shadow: none;
}

/* ---------- progress ---------- */
progress {
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-3);
  -webkit-appearance: none;
  appearance: none;
}

progress::-webkit-progress-bar {
  background: var(--surface-3);
}

progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--accent);
}

progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--accent);
}

/* ---------- helpers kept from the functional phase ---------- */
.rule-ok { color: var(--ok); }
.rule-fail { color: var(--ink-3); }
.app-form { max-width: 880px; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: inline-block; }

.htmx-swapping {
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}

.htmx-settling > * {
  animation: rise 0.6s var(--ease) both;
}

hr {
  border-color: var(--line);
  opacity: 1;
}

/* ---------- page components (home, project selection, empty states) ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin: 6px 0 28px;
}

.page-head h1 {
  margin: 10px 0 0;
  font-size: clamp(1.9rem, 1.2rem + 1.8vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.page-head p {
  margin: 8px 0 0;
  max-width: 56ch;
  color: var(--ink-3);
}

.bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
}

.bento > * {
  min-width: 0;
}

.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }

.bezel {
  padding: 6px;
  border-radius: var(--r-xl);
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-2);
  transition: transform 0.7s var(--ease), box-shadow 0.7s var(--ease);
}

.bezel-core {
  height: 100%;
  padding: 22px;
  border-radius: calc(var(--r-xl) - 6px);
  background: var(--surface);
  box-shadow: var(--highlight), 0 0 0 1px var(--line);
}

a.bezel {
  display: block;
  color: var(--ink);
}

a.bezel:hover {
  color: var(--ink);
  transform: translateY(-3px);
  box-shadow: 0 0 0 1px rgba(215, 25, 32, 0.22), var(--shadow-3);
}

.kpi {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 150px;
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
}

.kpi-icon.is-warn { color: var(--warn); background: var(--warn-soft); }
.kpi-icon.is-danger { color: var(--danger); background: var(--danger-soft); }
.kpi-icon.is-info { color: var(--info); background: var(--info-soft); }

.kpi-icon .icon {
  width: 22px;
  height: 22px;
}

.kpi-arrow {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--ink-3);
  background: var(--surface-3);
  transition: transform 0.5s var(--ease-spring), color 0.4s var(--ease), background 0.4s var(--ease);
}

a.bezel:hover .kpi-arrow {
  color: #fff;
  background: var(--ink);
  transform: translate(2px, -2px) scale(1.06);
}

.kpi-arrow .icon {
  width: 16px;
  height: 16px;
}

.kpi-value {
  font-size: clamp(2.2rem, 1.6rem + 1.4vw, 2.9rem);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 1;
}

.kpi-label {
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--ink-3);
}

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

.panel-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.panel-head a {
  font-size: 13px;
  font-weight: 550;
}

.feed {
  list-style: none;
  margin: 0;
  padding: 0;
}

.feed li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-top: 1px solid var(--line);
}

.feed li:first-child {
  border-top: 0;
}

.feed-icon {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--ink-2);
  background: var(--surface-3);
}

.feed-icon .icon {
  width: 18px;
  height: 18px;
}

.feed-main {
  min-width: 0;
  flex: 1;
  line-height: 1.3;
}

.feed-main a,
.feed-title {
  display: block;
  font-weight: 550;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-main a:hover {
  color: var(--accent);
}

.feed-sub {
  font-size: 12.5px;
  color: var(--ink-3);
}

.feed-end {
  font-size: 12.5px;
  font-weight: 550;
  white-space: nowrap;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 12px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13.5px;
}

.empty .icon {
  width: 30px;
  height: 30px;
  color: var(--ink-4);
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.project-card .bezel-core {
  display: flex;
  flex-direction: column;
  gap: 26px;
  min-height: 190px;
}

.project-monogram {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: #fff;
  background: radial-gradient(120% 120% at 20% 10%, #2f6fbd 0%, var(--accent) 45%, #072f60 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 12px 24px -12px rgba(215, 25, 32, 0.7);
}

.project-card h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.025em;
}

/* modules that are not in service yet: one plain bold sentence */
.not-ready {
  margin: 12px 0 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}

/* ---------- authentication (login, errors) ---------- */
.auth {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
}

.auth-art {
  position: relative;
  margin: 16px 0 16px 16px;
  padding: 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  border-radius: 32px;
  color: #f2f2f2;
  background:
    radial-gradient(900px 500px at 85% 10%, rgba(225, 29, 29, 0.30), transparent 60%),
    radial-gradient(700px 520px at 0% 110%, rgba(255, 255, 255, 0.07), transparent 60%),
    linear-gradient(160deg, #1b1b1c 0%, #0f0f10 55%, #060606 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), var(--shadow-3);
}

.auth-logo {
  position: relative;
  z-index: 1;
  display: block;
  width: auto;
  height: 64px;
  align-self: flex-start;
}

.auth-art .eyebrow-pill {
  color: #ffd5d5;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.auth-headline {
  position: relative;
  z-index: 1;
  max-width: 15ch;
  margin: 18px 0 0;
  font-size: clamp(2.3rem, 1.2rem + 3vw, 4rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.045em;
  color: #fff;
}

.auth-lead {
  position: relative;
  z-index: 1;
  max-width: 44ch;
  margin-top: 18px;
  color: rgba(242, 242, 242, 0.66);
  font-size: 15px;
}

.auth-facts {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auth-facts span {
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  color: rgba(242, 242, 242, 0.85);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

/* wind turbines (pure SVG + CSS transform) */
.turbines {
  position: absolute;
  right: -40px;
  bottom: -10px;
  width: min(560px, 78%);
  height: auto;
  opacity: 0.9;
  pointer-events: none;
}

.turbines .rotor {
  transform-box: view-box;
  animation: spin 9s linear infinite;
}

.turbines .rotor.r1 { transform-origin: 401px 130px; }
.turbines .rotor.r2 { transform-origin: 230px 212px; animation-duration: 12s; }
.turbines .rotor.r3 { transform-origin: 499px 249px; animation-duration: 7.5s; }

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

.auth-panel {
  display: grid;
  place-items: center;
  padding: 40px 24px;
}

.auth-card {
  width: min(430px, 100%);
}

.auth-card .bezel-core {
  padding: 34px 32px 30px;
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 1.75rem;
  letter-spacing: -0.035em;
}

.auth-card .lead-text {
  margin-bottom: 24px;
  color: var(--ink-3);
}

.auth-card .btn-primary {
  width: 100%;
  min-height: 46px;
  justify-content: space-between;
  padding-left: 1.3rem;
  padding-right: 1.3rem;
}

.auth-foot {
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-4);
}

.plain-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 32px 18px;
}

.plain-logo {
  display: block;
  width: auto;
  height: 32px;
}

.plain-card {
  width: min(560px, 100%);
}

.plain-card .bezel-core {
  padding: 36px;
}

.plain-card h1 {
  font-size: 1.6rem;
  letter-spacing: -0.03em;
}

.error-code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-4);
  letter-spacing: 0.08em;
}

/* ---------- responsive ---------- */
@media (max-width: 1199.98px) {
  .span-3 { grid-column: span 6; }
  .span-4, .span-5, .span-7, .span-8 { grid-column: span 12; }
  .span-6 { grid-column: span 12; }
}

@media (max-width: 991.98px) {
  :root {
    --gutter: 12px;
  }

  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(320px, 88vw);
    transform: translateX(-104%);
    transition: transform 0.65s var(--ease);
  }

  body.nav-open .app-sidebar {
    transform: none;
  }

  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(17, 17, 17, 0.28);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s var(--ease);
  }

  body.nav-open .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .app-topbar {
    display: flex;
    margin-bottom: 18px;
  }

  .menu-toggle {
    display: inline-grid;
    position: relative;
  }

  .menu-toggle .bar {
    position: absolute;
    left: 11px;
    width: 18px;
    height: 1.5px;
    border-radius: 2px;
    background: currentColor;
    transition: transform 0.5s var(--ease), opacity 0.3s var(--ease);
  }

  .menu-toggle .bar:nth-child(1) { transform: translateY(-5px); }
  .menu-toggle .bar:nth-child(3) { transform: translateY(5px); }

  body.nav-open .menu-toggle .bar:nth-child(1) { transform: rotate(45deg); }
  body.nav-open .menu-toggle .bar:nth-child(2) { opacity: 0; }
  body.nav-open .menu-toggle .bar:nth-child(3) { transform: rotate(-45deg); }

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

  .auth-art {
    margin: 12px 12px 0;
    padding: 28px;
    min-height: 300px;
  }

  .auth-headline {
    font-size: clamp(2rem, 1.4rem + 3vw, 2.6rem);
  }
}

@media (max-width: 767.98px) {
  .bento {
    gap: 14px;
  }

  .span-3 {
    grid-column: span 6;
  }

  .kpi {
    gap: 12px;
    min-height: 0;
  }

  .kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }

  .kpi-value {
    font-size: 2rem;
  }

  .kpi-label {
    font-size: 12.5px;
  }


  .app-content form.row.g-3,
  .app-content form.app-form {
    padding: 18px;
  }

  .table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

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

@media print {
  .app-sidebar, .app-topbar, .nav-backdrop { display: none !important; }
  .app-shell { display: block; }
  body::before { display: none; }
  .table, .card, .bezel { box-shadow: none !important; }
}

/* ---------- history timeline ---------- */
.timeline {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0 0 0 54px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: linear-gradient(180deg, var(--line-2), transparent);
}

.timeline-item {
  position: relative;
  margin-bottom: 16px;
}

.timeline-dot {
  position: absolute;
  left: -54px;
  top: 10px;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-1);
}

.timeline-dot.is-import { color: var(--sand); }
.timeline-dot.is-system { color: var(--info); }

.timeline-dot .icon {
  width: 19px;
  height: 19px;
}

.timeline-card {
  padding: 16px 20px;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-1);
}

.timeline-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
}

.timeline-time {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--ink-3);
}

.timeline-change {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.timeline-change:first-of-type {
  border-top: 0;
}

.timeline-subject {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 550;
}

.diff {
  display: grid;
  grid-template-columns: minmax(120px, 200px) minmax(0, 1fr);
  gap: 4px 16px;
  margin: 10px 0 2px;
  font-size: 13.5px;
}

.diff dt {
  font-weight: 500;
  color: var(--ink-3);
}

.diff dd {
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.diff-old {
  color: var(--ink-3);
  text-decoration: line-through;
  text-decoration-color: rgba(179, 65, 46, 0.45);
}

.diff-new {
  color: var(--ink);
  font-weight: 550;
}

.diff-arrow {
  width: 14px;
  height: 14px;
  color: var(--ink-4);
}

.timeline-more {
  margin: 8px 0 0;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--ink-2);
  background: var(--sand-soft);
}

@media (max-width: 767.98px) {
  .timeline {
    padding-left: 0;
  }

  .timeline::before,
  .timeline-dot {
    display: none;
  }

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

/* ---------- dense data grid (monthly timesheet matrix) ---------- */
.table-responsive:has(> .table-matrix) {
  max-height: min(72vh, 900px);
  overflow: auto;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-2);
}

.table-responsive > .table-matrix {
  display: table;
  white-space: nowrap;
  border-radius: 0;
  box-shadow: none;
  font-size: 12.5px;
}

.table-matrix > :not(caption) > * > * {
  padding: 0.38rem 0.5rem;
  border-color: var(--line);
}

.table-matrix.table-bordered > :not(caption) > * > * {
  border-width: 0 1px 1px 0;
}

.table-matrix > thead > tr > th {
  position: sticky;
  top: 0;
  z-index: 2;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  box-shadow: inset 0 -1px 0 var(--line-2);
}

.table-matrix > tbody > tr > :first-child,
.table-matrix > thead > tr > :first-child,
.table-matrix > tfoot > tr > :first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 190px;
  text-align: left;
  background: var(--surface);
  box-shadow: inset -1px 0 0 var(--line-2);
}

.table-matrix > thead > tr > :first-child {
  z-index: 3;
  background: var(--surface-2);
}

.table-matrix > tbody > tr > :first-child small,
.table-matrix > tbody > tr > :first-child .text-muted {
  display: block;
  font-size: 11px;
}

.table-matrix > tbody > tr:hover > * {
  background: var(--accent-soft);
}

.table-matrix > tfoot > tr > * {
  position: sticky;
  bottom: 0;
  z-index: 1;
  background: var(--surface-2);
  box-shadow: inset 0 1px 0 var(--line-2);
}

.table-matrix > tfoot > tr > :first-child {
  z-index: 3;
  background: var(--surface-2);
}

/* nested panels: a detail list or table inside a card is not a second floating panel */
.card dl.row,
.bezel-core dl.row {
  max-width: none;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.card .table,
.bezel-core .table {
  box-shadow: 0 0 0 1px var(--line);
}

.app-content .card {
  margin-bottom: 26px;
}

.card .card-body > dl.row:last-child,
.card > dl.row:last-child {
  margin-bottom: 0;
}

.timeline-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
}

.timeline-summary-note {
  width: 100%;
  font-size: 12.5px;
  color: var(--ink-3);
}

.summary-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-2);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

.summary-chip strong {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* monthly grid: hours on a day that is not approved yet */
.table-matrix td.cell-pending {
  color: var(--ink-3);
  background-image: radial-gradient(circle at calc(100% - 8px) 8px, var(--warn) 2.5px, transparent 3px);
}

/* empty states on list pages: a quiet recessed tray instead of a bare sentence */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 4px 0 26px;
  padding: 48px 20px;
  border-radius: var(--r-lg);
  text-align: center;
  font-size: 14px;
  color: var(--ink-3);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 2px 6px rgba(17, 17, 17, 0.03);
}

.empty-state .icon {
  width: 46px;
  height: 46px;
  padding: 11px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), 0 6px 18px -8px rgba(17, 17, 17, 0.18);
}

.empty-state.is-compact {
  flex-direction: row;
  justify-content: flex-start;
  margin: 0;
  padding: 14px 16px;
  font-size: 13.5px;
}

.empty-state.is-compact .icon {
  width: 30px;
  height: 30px;
  padding: 6px;
}

.min-w-0 {
  min-width: 0;
}

.form-switch .form-check-input {
  width: 2.3em;
  height: 1.3em;
  margin-top: 0.1em;
  border-radius: 2em;
  cursor: pointer;
  transition: background-position 0.35s var(--ease), background-color 0.35s var(--ease);
}

/* ---------- document browser: folder tree + document list ---------- */
.doc-browser {
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.doc-tree-panel {
  position: sticky;
  top: var(--gutter);
}

.doc-tree-panel .bezel-core {
  padding: 16px 12px 14px;
  max-height: calc(100dvh - 2 * var(--gutter) - 12px);
  overflow-y: auto;
  scrollbar-width: none;
}

.doc-tree-panel .eyebrow {
  display: block;
  padding: 2px 10px 10px;
}

.doc-tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.doc-tree .doc-tree {
  margin-left: 17px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.tree-item > details > summary {
  list-style: none;
}

.tree-item > details > summary::-webkit-details-marker {
  display: none;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 5px 8px 5px 4px;
  margin: 1px 0;
  border-radius: 10px;
  color: var(--ink-2);
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.35s var(--ease), color 0.35s var(--ease);
}

.tree-row:hover {
  background: var(--surface-3);
}

.tree-row.is-selected {
  background: var(--accent-soft);
}

.tree-row.is-selected .tree-name {
  color: var(--accent-ink);
  font-weight: 600;
}

.tree-all {
  padding-left: 8px;
  margin-bottom: 4px;
}

.tree-caret {
  flex: none;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: var(--ink-4);
}

.tree-caret .icon {
  width: 13px;
  height: 13px;
  transition: transform 0.45s var(--ease);
}

details[open] > summary .tree-caret .icon {
  transform: rotate(90deg);
}

.tree-folder {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--accent);
}

details[open] > summary > .tree-folder,
.tree-row.is-selected .tree-folder {
  color: var(--accent-ink);
}

.tree-name {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--ink);
  font-weight: 500;
}

a.tree-name:hover {
  color: var(--accent);
}

.tree-name.is-locked {
  color: var(--ink-4);
  font-weight: 400;
}

.tree-flag {
  flex: none;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-3);
  background: var(--surface-3);
}

.tree-flag.is-confidential {
  color: var(--brand-red);
  background: var(--brand-red-soft);
}

.tree-count {
  flex: none;
  margin-left: auto;
  min-width: 24px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

.tree-row.is-selected .tree-count {
  color: #fff;
  background: var(--accent);
  box-shadow: none;
}

.doc-main {
  min-width: 0;
}

.doc-main-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 4px 0 16px;
}

.doc-main-head h2 {
  margin: 4px 0 0;
  font-size: 1.35rem;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.doc-search {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 10px;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-1);
}

.doc-search-field {
  position: relative;
  flex: 1 1 280px;
  margin: 0;
}

.doc-search-field .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--ink-4);
  pointer-events: none;
}

.doc-search-field .form-control {
  padding-left: 42px;
}

.doc-search-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding-left: 0;
  white-space: nowrap;
}

.doc-search-switch .form-check-input {
  float: none;
  margin: 0;
}

.doc-search .btn {
  min-width: 96px;
}

.doc-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.doc-title a {
  font-weight: 600;
}

.doc-icon {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
}

.doc-icon.is-pdf {
  color: var(--brand-red);
  background: var(--brand-red-soft);
}

.doc-icon.is-sheet {
  color: var(--ok);
  background: var(--ok-soft);
}

.doc-icon .icon {
  width: 20px;
  height: 20px;
}

.doc-file {
  margin-top: 2px;
  font-size: 12px;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}

.doc-folder {
  font-size: 13px;
  color: var(--ink-2);
  min-width: 140px;
}

.version-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent-soft);
}

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

  .doc-tree-panel {
    position: static;
  }

  .doc-tree-panel .bezel-core {
    max-height: none;
  }
}

/* ---------- monthly timesheet: toolbar, legend, colour-coded grid ---------- */
.icon.flip {
  transform: scaleX(-1);
}

.month-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 8px 10px;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-1);
}

.month-switch {
  display: flex;
  align-items: center;
  gap: 6px;
}

.month-switch strong {
  min-width: 128px;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.month-switch .icon-btn {
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

.month-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.month-filter .form-control,
.month-filter .form-select {
  width: auto;
  min-width: 170px;
}

.month-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.month-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 150px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}

.month-stat span {
  font-size: 12px;
  color: var(--ink-3);
}

.month-stat strong {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.month-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
  color: var(--ink-2);
}

.month-legend li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-cell {
  position: relative;
  width: 26px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
  background-color: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-2);
}

.legend-cell.cell-pending {
  color: var(--ink-3);
  background-image: radial-gradient(circle at calc(100% - 5px) 5px, var(--warn) 2.5px, transparent 3px);
}

/* attendance colours (grid cells and legend) */
.att-LEAVE { color: var(--info) !important; background-color: var(--info-soft) !important; font-weight: 600; }
.att-SICK { color: var(--brand-red) !important; background-color: var(--brand-red-soft) !important; font-weight: 600; }
.att-ABSENT { color: var(--ink-3) !important; background-color: var(--surface-3) !important; }
.att-HOLIDAY { color: var(--warn) !important; background-color: var(--warn-soft) !important; font-weight: 600; }

.is-weekend,
.month-grid td.att-OFF {
  background-color: var(--surface-2);
  background-image: repeating-linear-gradient(135deg, transparent 0 5px, rgba(17, 17, 17, 0.035) 5px 6px);
}

.legend-cell.is-weekend {
  box-shadow: inset 0 0 0 1px var(--line-2);
}

.month-grid > thead > tr > th {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
  line-height: 1.15;
}

.month-grid .day-no {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink);
}

.month-grid .day-name {
  display: block;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--ink-4);
}

.month-grid > thead > tr > th.is-weekend .day-no {
  color: var(--ink-3);
}

.month-grid > tbody > tr > td {
  min-width: 34px;
  font-variant-numeric: tabular-nums;
}

.month-grid .person-name {
  font-weight: 500;
}

.month-grid .col-total {
  min-width: 78px;
  font-weight: 600;
  color: var(--accent-ink);
  background-color: var(--accent-soft);
}

.month-grid > thead > tr > th.col-total {
  font-size: 10.5px;
  letter-spacing: 0.04em;
}

.month-grid > tfoot > tr > * {
  font-weight: 600;
}

.doc-search-switch .form-check-label {
  margin: 0;
  line-height: 1.2;
  font-size: 13.5px;
  color: var(--ink-2);
  cursor: pointer;
}

.tree-lock {
  flex: none;
  display: inline-grid;
  place-items: center;
  color: var(--brand-red);
}

.tree-lock .icon {
  width: 14px;
  height: 14px;
}

/* ---------- Mentek: black navigation panel with the light logo ---------- */
.sidebar-shell {
  background: rgba(17, 17, 17, 0.06);
}

.sidebar-core {
  color: #fff;
  /* the site photo of the login page, darkened so the menu stays readable */
  background:
    linear-gradient(180deg, rgba(14, 14, 15, 0.7) 0%, rgba(12, 12, 13, 0.84) 45%, rgba(10, 10, 11, 0.95) 100%),
    url("../img/login-bg.webp") 64% 50% / cover no-repeat,
    #0d0d0e;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 0 0 1px rgba(0, 0, 0, 0.55);
}

.brand-logo {
  height: 40px;
}

.sidebar-nav .eyebrow,
.nav-section > .eyebrow {
  color: rgba(255, 255, 255, 0.36);
}

.nav-link-app {
  color: rgba(255, 255, 255, 0.74);
}

.nav-link-app .icon {
  color: rgba(255, 255, 255, 0.48);
}

.nav-link-app:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.nav-link-app:hover .icon {
  color: #fff;
}

.nav-link-app.is-active {
  color: #fff;
  background: linear-gradient(90deg, rgba(225, 29, 29, 0.24), rgba(225, 29, 29, 0.08));
  box-shadow: inset 0 0 0 1px rgba(225, 29, 29, 0.22);
}

.nav-link-app.is-active .icon {
  color: #ff5252;
}

.nav-link-app.is-soon {
  color: rgba(255, 255, 255, 0.5);
}

.nav-badge {
  box-shadow: 0 0 0 2px #121213;
}

.sidebar-user {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.user-name {
  color: #fff;
}

.user-sub {
  color: rgba(255, 255, 255, 0.5);
}

.avatar {
  color: #fff;
  background: linear-gradient(160deg, #ef3b3b, #b5141a);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.user-actions .icon-btn {
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.user-actions .icon-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
}

/* small screens: the top bar is black too */
.app-topbar {
  color: #fff;
  background: rgba(14, 14, 15, 0.92);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), var(--shadow-1);
}

.app-topbar .icon-btn {
  color: #fff;
}

.app-topbar .icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.topbar-brand img {
  height: 26px;
}

/* neutral file icon; red stays for PDF */
.doc-icon {
  color: var(--ink-2);
  background: var(--surface-3);
}

.version-pill {
  color: var(--ink);
  background: var(--surface-3);
}

/* links in lists: black text, red on hover */
.table > tbody a:not(.btn) {
  color: var(--ink);
  font-weight: 500;
}

.table > tbody a:not(.btn):hover {
  color: var(--accent);
}

.auth-logo {
  height: 46px;
}

/* ---------- AI assistant: corner button + chat panel ---------- */
.chatbot {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  pointer-events: none;
}

.chatbot > * {
  pointer-events: auto;
}

.chat-launcher {
  position: relative;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: 0 14px 30px -12px rgba(34, 28, 93, 0.55), 0 0 0 4px rgba(255, 255, 255, 0.9);
  transition: transform 0.5s var(--ease-spring), box-shadow 0.4s var(--ease);
}

.chat-launcher img {
  display: block;
  width: 60px;
  height: 60px;
  border-radius: 999px;
}

.chat-launcher:hover {
  transform: translateY(-2px) scale(1.04);
}

.chat-launcher:active {
  transform: scale(0.96);
}

.chat-launcher::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  box-shadow: 0 0 0 0 rgba(114, 115, 189, 0.45);
  animation: chat-pulse 2.8s var(--ease) infinite;
}

.chatbot.is-open .chat-launcher::after {
  animation: none;
}

.chat-launcher-tag {
  position: absolute;
  top: -4px;
  right: -6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--brand-red);
  box-shadow: 0 0 0 2px #fff;
}

.chat-panel {
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100dvh - 120px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), 0 30px 70px -28px rgba(17, 17, 17, 0.45);
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 0.32s var(--ease), transform 0.45s var(--ease);
}

.chatbot.is-open .chat-panel {
  opacity: 1;
  transform: none;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(14, 14, 15, 0.86), rgba(14, 14, 15, 0.94)),
    url("../img/login-bg-sm.webp") 60% 40% / cover no-repeat,
    #111;
}

.chat-avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
}

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

.chat-head-text strong {
  font-size: 14.5px;
  font-weight: 600;
}

.chat-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
}

.chat-status i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #3ecf8e;
  box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.2);
}

.chat-close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.08);
}

.chat-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}

.chat-close .icon {
  width: 18px;
  height: 18px;
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--surface-2);
  scrollbar-width: thin;
}

.chat-msg {
  display: flex;
}

.chat-msg p {
  max-width: 84%;
  margin: 0;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  animation: rise 0.45s var(--ease) both;
}

.chat-msg.is-bot p {
  color: var(--ink);
  background: var(--surface);
  border-bottom-left-radius: 5px;
  box-shadow: 0 0 0 1px var(--line);
}

.chat-msg.is-user {
  justify-content: flex-end;
}

.chat-msg.is-user p {
  color: #fff;
  background: var(--ink);
  border-bottom-right-radius: 5px;
}

.chat-msg.is-typing p {
  display: inline-flex;
  gap: 4px;
  padding: 13px 14px;
}

.chat-msg.is-typing i {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--ink-4);
  animation: chat-dot 1s var(--ease) infinite;
}

.chat-msg.is-typing i:nth-child(2) { animation-delay: 0.15s; }
.chat-msg.is-typing i:nth-child(3) { animation-delay: 0.3s; }

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.chat-chip {
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-2);
  transition: color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.chat-chip:hover {
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(215, 25, 32, 0.4);
}

.chat-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.chat-input input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.chat-input input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.12);
}

.chat-input button {
  flex: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  transition: transform 0.4s var(--ease-spring), background 0.3s var(--ease);
}

.chat-input button:hover {
  background: var(--accent-ink);
  transform: translate(1px, -1px);
}

.chat-input button .icon {
  width: 18px;
  height: 18px;
}

.chat-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 10px 9px;
  font-size: 11px;
  color: var(--ink-4);
  background: var(--surface);
}

.chat-foot img {
  display: block;
  width: auto;
  height: 14px;
}

@keyframes chat-pulse {
  0% { box-shadow: 0 0 0 0 rgba(114, 115, 189, 0.45); }
  70% { box-shadow: 0 0 0 14px rgba(114, 115, 189, 0); }
  100% { box-shadow: 0 0 0 0 rgba(114, 115, 189, 0); }
}

@keyframes chat-dot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-4px); opacity: 1; }
}

@media (max-width: 767.98px) {
  .chatbot {
    right: 14px;
    bottom: 14px;
  }

  .chat-launcher,
  .chat-launcher img {
    width: 52px;
    height: 52px;
  }

  .chat-panel {
    height: min(520px, calc(100dvh - 96px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-launcher::after,
  .chat-msg.is-typing i {
    animation: none;
  }
}

@media print {
  .chatbot {
    display: none;
  }
}
