@import url('inventory.css');

/*
  DawaDesk UI theme
  Direction: Aid Template (clean, modern, lots of whitespace) +
  a bit of Documentise sidebar hover feel.
  Accent: dawagu #03A9F4
  No build step.
*/

:root {
  --bg: #f6f7f9;
  --grid: rgba(15, 23, 42, 0.035);
  --surface: #ffffff;
  --surface-muted: #fbfcfd;

  --text: #0f172a;      /* slate-900 */
  --muted: #64748b;     /* slate-500 */
  --muted2: #94a3b8;    /* slate-400 */

  --border: rgba(15, 23, 42, 0.10);
  --border-strong: rgba(15, 23, 42, 0.14);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 10px 24px rgba(15, 23, 42, 0.08);

  --accent: #03a9f4;
  --accent-soft: rgba(3, 169, 244, 0.14);
  --accent-border: rgba(3, 169, 244, 0.35);

  --radius: 14px;
  --radius-sm: 12px;
  --sidebar-w: 292px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: var(--text);
  background:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px),
    var(--bg);
  background-size: 42px 42px;
}

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

/* Layout */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 18px;
  border-right: 1px solid var(--border);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
}

.main {
  padding: 22px 26px 40px;
}

.container {
  max-width: 1160px;
  margin: 0 auto;
}

/* Brand */
.brand {
  padding: 14px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, var(--surface-muted));
  box-shadow: var(--shadow-sm);
}

.brand__title {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.2px;
}

.brand__sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* Sidebar nav (modern, icon + label, Documentise-ish hover) */
.nav {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: calc(100vh - 120px);
}

.nav__item {
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 120ms ease;
}

.nav__icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: rgba(15,23,42,0.70);
}

.nav__icon svg { width: 18px; height: 18px; }

.nav__label {
  font-weight: 650;
  font-size: 14px;
  letter-spacing: -0.15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* left indicator bar (animated) */
.nav__item::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  width: 0px;
  height: 18px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: var(--accent);
  opacity: 0;
  transition: width 180ms ease, opacity 180ms ease;
}

.nav__item:hover {
  border-color: var(--border);
  background: rgba(255,255,255,0.85);
  transform: translateY(-1px);
}

.nav__item:hover::before { width: 3px; opacity: 1; }

.nav__item.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.nav__item.active::before { width: 3px; opacity: 1; }

.nav__item.active .nav__icon { color: var(--accent); }

.nav__group {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.nav__group_title {
  color: var(--muted2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 8px 8px;
}

.nav__spacer { flex: 1; }

.nav__footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 6px;
}

.nav__toggle { width: 100%; text-align: left; }

.nav__logout { margin: 0; }

/* Collapsed sidebar */
html.sidebar-collapsed .layout { grid-template-columns: 84px 1fr; }
html.sidebar-collapsed .sidebar { padding: 14px 12px; }
html.sidebar-collapsed .brand { padding: 10px; }
html.sidebar-collapsed .brand__sub { display: none; }
html.sidebar-collapsed .brand__title { font-size: 14px; }
html.sidebar-collapsed .nav__group_title { display: none; }
html.sidebar-collapsed .nav__item { grid-template-columns: 22px; justify-content: center; }
html.sidebar-collapsed .nav__label { display: none; }
html.sidebar-collapsed .nav__item { padding: 10px; }

html.sidebar-collapsed .nav__item::before { left: 6px; }

/* Tooltip-ish title when collapsed */
html.sidebar-collapsed .nav__item { position: relative; }
html.sidebar-collapsed .nav__item:hover::after {
  content: attr(aria-label);
  position: absolute;
  left: 72px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(15,23,42,0.92);
  color: #fff;
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: var(--shadow);
}

/* Provide aria-labels via nav__label text fallback: set using JS? We don't.
   We'll keep it minimal: only the special buttons have aria-label. */

/* CRM group links: force vertical list (avoid accidental inline layout) */
.nav__group a { display: grid; }


/* Header */
.header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

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

.header__title {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.6px;
}

.header__subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

/* Content */
.content { display: flex; flex-direction: column; gap: 14px; }

.grid { display: grid; gap: 14px; }
.grid.cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: 1fr 1fr; }

.card, .panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

/* Stat cards (Aid-ish) */
.card {
  padding: 16px 16px 14px;
}

.card__title {
  color: var(--muted2);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.9px;
}

.card__value {
  font-size: 34px;
  font-weight: 900;
  margin: 10px 0 6px;
  letter-spacing: -0.8px;
}

.card .muted { color: var(--muted); }

.panel__title {
  font-weight: 800;
  letter-spacing: -0.3px;
  margin-bottom: 10px;
}

table.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(15,23,42,0.07);
}
.table th {
  color: var(--muted2);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.9px;
}

/* Modern list rows (replace "Excel table" feel) */
.rows {
  display: grid;
  gap: 10px;
}

.row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 0.7fr 0.7fr 0.9fr;
  gap: 12px;
  align-items: center;
  padding: 12px 12px;
  border: 1px solid rgba(15,23,42,0.08);
  border-radius: 14px;
  background: rgba(255,255,255,0.85);
}

.row__head {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 0.7fr 0.7fr 0.9fr;
  gap: 12px;
  padding: 0 12px;
  color: var(--muted2);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.9px;
}

.row b { font-weight: 800; }

@media (max-width: 980px) {
  .row, .row__head { grid-template-columns: 1.2fr 1fr 1fr; }
  .row [data-col="event"], .row [data-col="tech"], .row [data-col="contact"],
  .row__head [data-col="event"], .row__head [data-col="tech"], .row__head [data-col="contact"] { display: none; }
}

/* File "drawer" cards (Brandlize-ish: hover feels like pulling a folder out) */
.filegrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.filegrid-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.filegrid--stack {
  position: relative;
  height: 260px;
  width: min(420px, 100%);
  margin: 0 auto;
}

.filegrid--stack .filecard {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  transition: transform 0.2s ease, opacity 0.2s ease;
  opacity: 1;
}

.filecard {
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.filecard__tab {
  height: 18px;
  width: 54%;
  border: 1px solid rgba(15,23,42,0.10);
  border-bottom: none;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  background: rgba(255,255,255,0.95);
  margin-left: 12px;
}

.filecard__body {
  border: 1px solid rgba(15,23,42,0.10);
  border-radius: 16px;
  background: rgba(255,255,255,0.92);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  transform: translateY(0);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.filecard:hover .filecard__body,
.filecard:focus-visible .filecard__body {
  transform: translateY(-36px);
  box-shadow: var(--shadow);
  border-color: rgba(3,169,244,0.35);
}

.filecard:focus-visible { outline: none; }

.filecard__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.filecard__meta .muted.small {
  flex: 0 0 36px;
  text-align: right;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid rgba(15,23,42,0.10);
  background: rgba(59,130,246,0.12);
  color: #2563eb;
}

.badge--soft {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(59,130,246,0.12);
  color: #2563eb;
}

.filecard--recurring .filecard__body,
.filecard--recurring .filecard__tab {
  border-color: rgba(3,169,244,0.35);
  background: linear-gradient(180deg, rgba(239,246,255,0.98), rgba(255,255,255,0.94));
}

.recurring-panel {
  border: 1px solid rgba(3,169,244,0.24);
  border-radius: 18px;
  background: rgba(239,246,255,0.70);
  padding: 14px;
  margin: 0 0 14px;
}

.recurring-panel__head,
.recurring-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.recurring-panel__list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.recurring-item {
  border-radius: 12px;
  background: rgba(255,255,255,0.72);
  padding: 8px 10px;
}

.recurring-item > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}

.badge--status {
  padding: 2px 6px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1;
  justify-content: center;
}
.badge--status.badge--ok {
  background: #e7f7ef;
  color: #1b8a5a;
  border: 1px solid #bfe9d1;
}
.badge--status.badge--warn {
  background: #fff3e0;
  color: #c9790e;
  border: 1px solid #ffd59a;
}

.filecard__title {
  font-weight: 900;
  letter-spacing: -0.3px;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 44px);
}

.filecard__hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  min-height: 34px;
}

.filecard__actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.filecard__action {
  font-size: 12px;
  font-weight: 900;
  color: rgba(15,23,42,0.70);
}

.filecard__action--primary { color: var(--accent); }

@media (max-width: 980px) {
  .filegrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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

/* Folder modal (2-page folder opening) */
html.modal-open { overflow: hidden; }

.folder-overlay {
  position: fixed;
  inset: 0;
  z-index: 23000;
  display: none;
}

.folder-overlay.is-open { display: block; }

.folder-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,0.35);
  backdrop-filter: blur(6px);
}

.folder {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(1460px, calc(100vw - 24px));
  /* Both sheets slightly wider for balanced document + filing layout */
  height: min(
    calc((min(1460px, calc(100vw - 24px)) / 2) / 0.707 + 40px),
    calc(100vh - 24px)
  );
  border-radius: 18px;
  background: transparent;
}

.folder__close {
  position: absolute;
  right: 12px;
  top: 10px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(15,23,42,0.55);
  color: #fff;
  font-size: 24px;
  line-height: 0;
  cursor: pointer;
  z-index: 5;
}

.folder__spine {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(15,23,42,0.08);
  transform: translateX(-50%);
}

.folder__sheet {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(15,23,42,0.10);
  box-shadow: var(--shadow);
  overflow: hidden;
  backface-visibility: visible;
  -webkit-font-smoothing: auto;
}

.folder__sheet--left {
  left: 0;
  border-top-left-radius: 18px;
  border-bottom-left-radius: 18px;
  transform-origin: right center;
  transform: rotateY(0deg);
}

.folder__sheet--right {
  right: 0;
  border-top-right-radius: 18px;
  border-bottom-right-radius: 18px;
  transform-origin: left center;
  transform: rotateY(0deg);
}

/* Disabled 3D rotation for crisp text */
.folder-overlay.is-open .folder__sheet--left {
  transform: translateZ(0) rotateY(0deg);
}
.folder-overlay.is-open .folder__sheet--right {
  transform: translateZ(0) rotateY(0deg);
}

.folder-overlay.is-open.is-anim .folder__sheet--left {
  transform: translateZ(0) rotateY(0deg);
}
.folder-overlay.is-open.is-anim .folder__sheet--right {
  transform: translateZ(0) rotateY(0deg);
}

.folder__sheet_header {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(15,23,42,0.08);
  background: rgba(255,255,255,0.96);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.folder__sheet_header-left {
  display: grid;
  gap: 2px;
}

.folder__title { font-weight: 900; letter-spacing: -0.3px; }
.folder__title--center { text-align: center; width: 100%; }
.folder__sheet_header { gap: 12px; }
.folder__sheet_header-status { min-width: 90px; }

.folder__zoom {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15,23,42,0.04);
  border: 1px solid rgba(15,23,42,0.12);
  padding: 4px 6px;
  border-radius: 999px;
}

.folder__zoom_label {
  font-size: 12px;
  font-weight: 700;
  min-width: 46px;
  text-align: center;
  color: #0f172a;
}

.folder__pdf {
  height: calc(100% - 54px);
  padding: 16px;
}

.folder__pdf_view {
  height: 100%;
  border-radius: 14px;
  overflow: auto;
  background: #fff;
  display: none;
}

.folder__pdf_frame {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 14px;
  background: #fff;
  display: block;
}

.folder__pdf_placeholder {
  height: 100%;
  border-radius: 14px;
  border: 1px dashed rgba(15,23,42,0.18);
  background:
    linear-gradient(to right, rgba(15,23,42,0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15,23,42,0.03) 1px, transparent 1px),
    rgba(255,255,255,0.7);
  background-size: 24px 24px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
}

.folder__meta {
  height: calc(100% - 54px);
  padding: 16px;
  overflow: auto;
}

.modal__meta {
  padding: 14px;
  overflow: auto;
  background: #f8fafc;
  border-radius: 12px;
}

.folder__hint {
  display: inline-block;
  width: 100%;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: ltr;
  text-align: left;
  font-size: 12px;
  color: #64748b;
}

.kv2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.kv2--form {
  grid-template-columns: 7fr 3fr;
  align-items: start;
}

.kv2--form > div { min-width: 0; }

.kv2 > div {
  min-width: 0;
}

.recurring-modal-box {
  border: 1px solid rgba(3,169,244,0.24);
  background: rgba(239,246,255,0.70);
  border-radius: 14px;
  padding: 8px 10px;
  margin-bottom: 12px;
}

.recurring-modal-box.is-expanded {
  padding: 12px;
}

.recurring-modal-box__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.recurring-modal-box__toggle {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  color: inherit;
  cursor: pointer;
  min-width: 0;
}

.recurring-modal-box__toggle strong {
  display: block;
  line-height: 1.2;
}

.recurring-modal-box__chevron {
  width: 16px;
  color: #0284c7;
  font-weight: 800;
}

.recurring-modal-box__body[hidden] {
  display: none !important;
}

.recurring-modal-box__check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 700;
}

.recurring-modal-box__select {
  display: block;
  margin-top: 10px;
}

.recurring-modal-box__fields {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 0.7fr;
  gap: 10px;
  margin-top: 10px;
}

.formgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.formgrid__full-row {
  grid-column: 1 / -1;
}

.formgrid__split-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 680px) {
  .formgrid__split-row {
    grid-template-columns: 1fr;
  }
}

.folder__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(15,23,42,0.08);
}

@media (max-width: 920px) {
  .folder { height: min(860px, calc(100vh - 24px)); }
  .folder__sheet { width: 100%; }
  .folder__sheet--left { left: 0; right: 0; width: 100%; border-radius: 18px; }
  .folder__sheet--right { display: none; }
  .folder__spine { display: none; }
}

.muted { color: var(--muted); }
.small { font-size: 12px; }

/* Buttons – unified with sales modal style */
.btn {
  appearance: none;
  border: 1px solid transparent;
  background: #fff;
  color: #0f172a;
  font: 600 13px/1 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, border-color 120ms ease, filter 120ms ease;
}

.btn--ghost {
  background: transparent;
  border-color: color-mix(in oklab, #e2e8f0, transparent 20%);
  color: #0f172a;
  box-shadow: none;
}
.btn--ghost:hover { background: color-mix(in oklab, #fff, transparent 30%); box-shadow: none; }

.btn--primary {
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #fff;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 12px;
  font: 600 13px/1 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  box-shadow: 0 14px 30px color-mix(in oklab, #2563eb, transparent 68%);
}
.btn--primary:hover { filter: brightness(1.02); }
.btn--primary:focus-visible { outline: 3px solid color-mix(in oklab, #2563eb, transparent 70%); outline-offset: 2px; }

/* Search */
.search {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.9);
  min-width: 320px;
}
.search svg { width: 18px; height: 18px; color: rgba(15,23,42,0.55); }
.search input {
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  color: var(--text);
}
.search input::placeholder { color: var(--muted2); }

@media (max-width: 820px) {
  .search { min-width: 0; width: 100%; }
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.09);
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }

.btn--small { padding: 7px 10px; font-size: 12px; }

.linklike {
  background: none;
  border: none;
  color: var(--muted);
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
}
.linklike:hover { color: var(--text); }

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

.kanban__col {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 10px;
}

.kanban__title {
  color: var(--muted2);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  margin: 2px 2px 10px;
}

.kanban__card {
  background: var(--surface-muted);
  border: 1px solid rgba(15,23,42,0.08);
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 8px;
}

.list { margin: 0; padding-left: 18px; }
.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

/* Login – simple card */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login__card {
  width: 420px;
  max-width: 100%;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.field { display: grid; gap: 6px; margin-top: 12px; }
.field span { color: var(--muted); font-size: 12px; font-weight: 700; }
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,0.14);
  background: #fff;
  color: var(--text);
  outline: none;
  font: inherit;
}
.field textarea { min-height: 96px; resize: vertical; }

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(3,169,244,0.55);
  box-shadow: 0 0 0 3px rgba(3,169,244,0.18);
}

.alert {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  color: #7f1d1d;
}



/* Make the app feel like a "platform" (more whitespace, less full-bleed) */
.main {
  padding: 26px 32px 48px;
}

/* Desktop sidebar behavior */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden; /* avoid the ugly inner scrollbar */
}

/* Responsive */
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .main { padding: 18px 18px 40px; }
  .grid.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
}

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


div.table { display: grid; gap: 6px; }
.table__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(15,23,42,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.75);
}
.table__cell { font-size: 14px; }

.lineitems { margin-top: 14px; display: grid; gap: 10px; }
.lineitems__head {
  display: grid;
  grid-template-columns: 24px 52px minmax(150px, 1fr) 150px 52px 86px 24px;
  gap: 6px;
  align-items: center;
}
.lineitems__head[data-booking-mode-active="split"] {
  grid-template-columns: 24px 52px minmax(150px, 1fr) 150px 52px 86px 24px;
}

.lineitems__row {
  display: grid;
  gap: 10px;
  padding: 10px 0 12px;
  border-top: 1px solid rgba(15,23,42,0.08);
}

.lineitems__rows .lineitems__row:first-child {
  border-top: 0;
  padding-top: 0;
}

.lineitems__main {
  display: grid;
  grid-template-columns: 24px 52px minmax(150px, 1fr) 150px 52px 86px 24px;
  gap: 6px;
  align-items: center;
}
.lineitems__rows[data-booking-mode-active="split"] .lineitems__main {
  grid-template-columns: 24px 52px minmax(150px, 1fr) 150px 52px 86px 24px;
}

.lineitems__box {
  border: 1px solid rgba(15,23,42,0.08);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.85);
}

.lineitems__rows {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.lineitems__primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 28px;
  margin: 0;
}

.lineitems__primary input { display: none; }

.lineitems__primary-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(15,23,42,0.35);
  background: #fff;
  transition: 0.15s ease;
}

.lineitems__primary input:checked + .lineitems__primary-dot {
  border-color: #3b82f6;
  background: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(15,23,42,0.92);
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(6px);
  transition: 0.2s ease;
  z-index: 9999;
}
.toast.is-show {
  opacity: 1;
  transform: translateY(0);
}

.dots {
  display: inline-flex;
  gap: 3px;
  margin-left: 4px;
  align-items: center;
}
.dots span {
  opacity: 0.2;
  animation: dotBlink 1s infinite;
  font-size: 16px;
  line-height: 1;
}
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBlink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

.btn.is-loading { pointer-events: none; }

.btn[data-extract] {
  min-width: 110px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cselect { position: relative; }
.cselect__btn {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(15,23,42,0.12);
  background: rgba(255,255,255,0.9);
  cursor: pointer;
}
.cselect__list {
  position: absolute;
  left: 0;
  right: auto;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid rgba(15,23,42,0.12);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-height: 280px;
  overflow: hidden;
  z-index: 80;
  display: none !important;
  width: 320px;
}
.cselect.is-open .cselect__list { display: block !important; }
.cselect { position: relative; }

.cselect__item {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cselect__code {
  color: var(--muted);
  font-size: 12px;
  min-width: 36px;
  text-align: right;
}

.cselect__item, .cselect__search { box-sizing: border-box; }
.cselect__item:hover { background: rgba(59,130,246,0.08); }
.cselect__items {
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 10px 6px;
  background: #fff;
}

.cselect__inner {
  max-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 10px 6px;
  background: #fff;
}

.cselect__tipwrap {
  position: absolute;
  left: -260px;
  width: 240px;
  z-index: 90;
  pointer-events: none;
}

.cselect__tip {
  background: #fff;
  border: 1px solid rgba(15,23,42,0.12);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 10px;
  font-size: 12px;
  color: #0f172a;
  pointer-events: none;
}
.cselect__tip-title { font-weight: 800; margin-bottom: 6px; }
.cselect__tip-body { color: #334155; line-height: 1.35; }
.cselect__tip-code { margin-top: 8px; color: var(--muted); font-size: 11px; }

.cselect__item--create {
  border-top: 1px solid rgba(15,23,42,0.08);
  font-weight: 700;
  position: sticky;
  bottom: 0;
  background: #fff;
  z-index: 2;
}
.cselect__item--create:hover { background: #fff; }
.cselect__search {
  width: calc(100% - 20px);
  margin: 8px 10px 4px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(15,23,42,0.12);
  background: #fff;
}

.lineitems__remove {
  border: 0;
  background: transparent;
  color: #ef4444;
  font-weight: 800;
  cursor: pointer;
  justify-self: center;
}

.lineitems__totals {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.lineitems__total-row {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}

.lineitems__total-row.total--strong {
  font-size: 16px;
  font-weight: 800;
}

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

.lineitems__booking-mode {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toggle {
  display:flex;
  background: rgba(15,23,42,0.06);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}

.toggle__btn {
  border: 0;
  background: transparent;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

.toggle__btn.is-active {
  background: white;
  box-shadow: var(--shadow-sm);
}
.lineitems__head {
  font-size: 12px;
  color: var(--muted, #71717a);
}
.lineitems__head > div:nth-child(1),
.lineitems__main > .lineitems__pos {
  text-align: left;
}
.lineitems__head > div:nth-child(5),
.lineitems__head > div:nth-child(6) {
  text-align: right;
}
.lineitems__row input, .lineitems__row select {
  width: 100%;
  min-width: 0;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(15,23,42,0.12);
  background: rgba(255,255,255,0.9);
}
.lineitems__row [data-category] {
  font-size: 12px;
}
.lineitems__row [data-title] {
  min-width: 0;
}
.lineitems__row [data-vat],
.lineitems__row [data-amount] {
  text-align: right;
}
.lineitems__row input[data-amount]::-webkit-outer-spin-button,
.lineitems__row input[data-amount]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.lineitems__row input[data-amount] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.lineitems__pos {
  font-weight: 700;
  color: #334155;
}
.lineitems__lead-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}
.lineitems__lead-header {
  white-space: nowrap;
  font-size: 11px;
  text-align: center;
}
.lineitems__row [data-category] {
  min-width: 0;
}
.cselect__item.is-active {
  background: rgba(59, 130, 246, 0.12);
  outline: 1px solid rgba(59, 130, 246, 0.35);
}
.lineitems__meta-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.lineitems__tax-treatment {
  grid-column: 3 / -1;
  align-items: center;
  gap: 8px;
  margin: -2px 30px 0 82px;
  padding: 8px 10px;
  border: 1px solid rgba(59,130,246,0.18);
  border-radius: 10px;
  background: rgba(59,130,246,0.06);
}
.lineitems__tax-treatment span {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}
.lineitems__tax-treatment select {
  width: auto;
  min-width: 230px;
}
.lineitems__tax-treatment em {
  font-size: 12px;
  color: var(--muted, #71717a);
  font-style: normal;
}
@media (max-width: 920px) {
  .lineitems__head, .lineitems__main { grid-template-columns: 1fr; }
  .lineitems__lead-cell,
  .lineitems__meta-right {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

.formgrid--2 {
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 920px) {
  .formgrid--2 { grid-template-columns: 1fr; }
}

.formgrid--70-30 {
  grid-template-columns: 7fr 3fr;
}
@media (max-width: 920px) {
  .formgrid--70-30 { grid-template-columns: 1fr; }
}

.tabs { display:flex; gap: 8px; margin-bottom: 10px; }
.tab { padding: 6px 10px; border-radius: 999px; border: 1px solid rgba(15,23,42,0.12); text-decoration:none; color: inherit; font-weight: 600; }
.tab--active { background: rgba(15,23,42,0.08); }

.switch-wrap { display:flex; align-items:center; gap: 10px; margin-bottom: 10px; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: .2s; border-radius: 999px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background-color: white; transition: .2s; border-radius: 999px; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.switch input:checked + .slider { background-color: #3b82f6; }
.switch input:checked + .slider:before { transform: translateX(20px); }
.switch input:focus-visible + .slider {
  box-shadow: 0 0 0 3px rgba(59,130,246,0.22);
  transform: scale(1.03);
}
.switch-wrap .switch-state,
.switch-wrap .muted.small {
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  letter-spacing: 0.01em;
}
.switch-wrap .switch-state.is-active { color: #64748b; }
.switch-wrap .switch-state:not(.is-active) { color: #64748b; opacity: 1; }



.modal { position: fixed; inset: 0; display: none; z-index: 20000; }

#projectDetailModal,
#projectEditModal,
#projectModal,
#salesDocModal {
  z-index: 21000;
}

#supplierModal,
#hospitalityModal {
  z-index: 24000;
}
.modal.is-open { display: block; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(15,23,42,0.35); backdrop-filter: blur(4px); }
.modal__panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 96px); overflow: auto; background: #fff; border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.modal__head { display:flex; align-items:center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.modal__title { font-weight: 800; }
.modal__body { padding: 4px 2px; }

.modal__panel--compact .field input,
.modal__panel--compact .field select,
.modal__panel--compact .field textarea {
  padding: 8px 10px;
  font-size: 14px;
}
.modal__panel--compact .grid.two {
  row-gap: 10px;
}

.sort-link { background: none; border: 0; padding: 0; font-weight: 700; cursor: pointer; }
.sort-link:hover { text-decoration: underline; }

.extract {
  border: 1px dashed rgba(15,23,42,0.15);
  border-radius: 12px;
  padding: 10px;
  margin: 10px 0 14px;
  background: rgba(255,255,255,0.75);
}

.extract__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.extract__body {
  font-size: 12px;
  color: var(--muted);
  white-space: pre-wrap;
  max-height: 140px;
  overflow: auto;
}

.extract[data-extract-hidden] {
  display: none;
}

.hospitality-box {
  border: 1px solid rgba(15,23,42,0.10);
  border-radius: 12px;
  padding: 12px;
  margin: 12px 0 14px;
  background: rgba(248,250,252,0.8);
}

.hospitality-box__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.hospitality-box__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
