:root {
  color-scheme: light;
  --ink: #121417;
  --muted: #677083;
  --soft: #8a94a6;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --surface: #f7f8fb;
  --panel: #ffffff;
  --panel-subtle: #fbfcfe;
  --accent: #635bff;
  --accent-dark: #4138d8;
  --green: #0f8f64;
  --danger: #b42318;
  --orange: #b54708;
  --blue: #175cd3;
  --shadow: 0 18px 50px rgba(18, 20, 23, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(99, 91, 255, 0.06), transparent 240px),
    var(--surface);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  color: #ffffff;
  background: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

button:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  box-shadow: 0 8px 22px rgba(99, 91, 255, 0.24);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  box-shadow: none;
}

button.secondary,
.tab {
  border-color: var(--line);
  color: var(--ink);
  background: #ffffff;
}

button.secondary:hover,
.tab:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  background: var(--panel-subtle);
  box-shadow: none;
}

button.danger {
  border-color: rgba(180, 35, 24, 0.22);
  color: var(--danger);
}

button.danger:hover {
  border-color: rgba(180, 35, 24, 0.32);
  color: var(--danger);
  background: rgba(180, 35, 24, 0.06);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
}

.app-shell.is-authenticated {
  grid-template-columns: 260px minmax(0, 1fr);
  transition: grid-template-columns 0.25s ease;
}

.app-shell.is-authenticated.sidebar-collapsed {
  grid-template-columns: minmax(0, 1fr);
}
.app-shell.is-authenticated.sidebar-collapsed .sidebar {
  display: none;
}
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 22px;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--green));
  font-weight: 800;
}

.brand-logo {
  display: block;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  object-fit: contain;
}

.brand-name,
.brand-meta,
.eyebrow,
.form-heading p,
.auth-copy p,
.metric-card p,
.message,
.section-copy,
.placeholder-list p,
.summary-label,
.summary-value {
  margin: 0;
}

.brand-name {
  font-size: 0.94rem;
  font-weight: 800;
}

.brand-meta {
  color: var(--soft);
  font-size: 0.78rem;
}

.side-nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
}

.nav-item:hover {
  color: var(--ink);
  background: transparent;
  box-shadow: none;
}

.nav-item.is-active {
  color: var(--ink);
  background: #f0f2f6;
}

.nav-link {
  text-decoration: none;
}

.nav-item-with-badge {
  justify-content: space-between;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--danger);
  font-size: 0.76rem;
  font-weight: 800;
}

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

.main-area {
  min-width: 0;
  padding: 24px 28px 48px;
}

.topbar,
.dashboard-heading,
.section-heading,
.top-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;

  min-height: 64px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

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

.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  font-size: 1.3rem;
  cursor: pointer;
}

.sidebar-toggle:hover {
  background: #f0f2f6;
}

.topbar-center {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.topbar-link:hover {
  color: var(--ink);
  background: #f0f2f6;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.session-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  max-width: 280px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.section-copy,
.placeholder-list p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.55;
}

h1,
h2,
h3,
legend {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  margin-top: 4px;
  font-size: 1.55rem;
  line-height: 1.18;
}

h2 {
  margin-top: 5px;
  font-size: 1.35rem;
  line-height: 1.25;
}

h3 {
  margin-top: 4px;
  font-size: 1rem;
}

legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(320px, 440px);
  gap: 24px;
  align-items: stretch;
  margin-top: 26px;
}

.auth-copy,
.auth-panel,
.surface,
.metric-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.auth-copy {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 360px;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(99, 91, 255, 0.12), rgba(15, 143, 100, 0.08)),
    #ffffff;
}

.auth-copy p:last-child {
  max-width: 520px;
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.auth-marketplace-link {
  display: inline-flex;
  width: fit-content;
  min-height: 40px;
  align-items: center;
  margin-top: 18px;
  padding: 0 14px;
  border-radius: 7px;
  color: #ffffff;
  background: var(--accent);
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
}

.auth-marketplace-link:hover {
  background: var(--accent-dark);
}

.link-button {
  width: fit-content;
  min-height: auto;
  padding: 0;
  border: 0;
  color: var(--accent);
  background: transparent;
  box-shadow: none;
  font: inherit;
  font-weight: 750;
  text-decoration: underline;
}

.link-button:hover {
  color: var(--accent-dark);
  background: transparent;
}

.auth-panel,
.surface {
  padding: 20px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f6f8;
}

.tab {
  min-height: 34px;
  border-radius: 6px;
}

.tab.is-active {
  border-color: #ffffff;
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(18, 20, 23, 0.08);
}

.form {
  display: grid;
  gap: 15px;
}

.form.compact {
  gap: 13px;
}

.form-heading {
  display: grid;
  gap: 4px;
}

.form-heading p {
  color: var(--muted);
  font-size: 0.92rem;
}

.app-dialog {
  width: min(92vw, 520px);
  max-height: min(88vh, 720px);
  margin: auto;
  padding: 22px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(18, 20, 23, 0.22);
}

.app-dialog::backdrop {
  background: rgba(18, 20, 23, 0.48);
  backdrop-filter: blur(2px);
}

.dialog-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.dialog-heading h2 {
  margin: 4px 0 6px;
}

.password-input-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.password-visibility-button {
  min-width: 72px;
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(180, 35, 24, 0.2);
  border-radius: 7px;
  color: var(--danger);
  background: rgba(180, 35, 24, 0.06);
  font-size: 0.84rem;
  font-weight: 750;
}

.field-message {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.field-message.error {
  color: var(--danger);
}

.dialog-actions {
  margin-top: 4px;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(99, 91, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(99, 91, 255, 0.12);
}

textarea {
  resize: vertical;
}

.dashboard {
  display: grid;
  gap: 18px;
  margin-top: 26px;
}

.module-section {
  display: grid;
  gap: 18px;
}

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

.metric-grid-wide {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
  min-height: 110px;
  padding: 18px;
  box-shadow: none;
}

.metric-card p {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 14px;
  font-size: 1.75rem;
  line-height: 1;
}

.overview-grid,
.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 18px;
  align-items: start;
}

.placeholder-surface {
  min-height: 100%;
}

.placeholder-list {
  display: grid;
  gap: 10px;
}

.dashboard-actions-grid {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.settings-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
}

.users-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
}

#platformAdminSection {
  display: grid;
  gap: 18px;
}

.surface {
  box-shadow: none;
}

.field-grid,
.price-grid,
.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

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

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

.summary-chip,
.rental-summary-box {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-subtle);
}

.summary-chip strong,
.summary-value {
  font-size: 1rem;
}

.summary-label,
.summary-value {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 9px;
}

.checkbox-label input {
  width: 17px;
  min-height: 17px;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(160px, 0.8fr));
  gap: 12px;
  margin-top: 16px;
}

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

.filter-field {
  gap: 5px;
}

.form-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.quick-actions button {
  flex: 1 1 160px;
}

.form-actions button {
  flex: 1 1 150px;
}

.row-actions {
  min-width: 180px;
}

.row-actions button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--soft);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

td {
  color: var(--ink);
  font-size: 0.92rem;
}

.item-title,
.item-muted,
.item-link,
.detail-stack span,
.status-pill {
  display: block;
}

.item-title {
  margin-bottom: 5px;
}

.item-muted,
.detail-stack {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.item-link {
  width: fit-content;
  margin-top: 7px;
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 800;
  text-decoration: none;
}

.item-link:hover {
  text-decoration: underline;
}

.status-pill {
  width: fit-content;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: capitalize;
}

.status-pill.status-reserved {
  color: var(--orange);
  background: rgba(181, 71, 8, 0.14);
}

.status-pill.status-active {
  color: var(--blue);
  background: rgba(23, 92, 211, 0.12);
}

.status-pill.status-planned {
  color: var(--orange);
  background: rgba(181, 71, 8, 0.14);
}

.status-pill.status-in_progress {
  color: var(--blue);
  background: rgba(23, 92, 211, 0.12);
}

.status-pill.status-completed {
  color: var(--green);
  background: rgba(15, 143, 100, 0.12);
}

.status-pill.status-returned {
  color: var(--green);
  background: rgba(15, 143, 100, 0.12);
}

.status-pill.status-cancelled {
  color: var(--danger);
  background: rgba(180, 35, 24, 0.12);
}

.status-pill.status-pending {
  color: var(--orange);
  background: rgba(181, 71, 8, 0.14);
}

.status-pill.status-approved {
  color: var(--green);
  background: rgba(15, 143, 100, 0.12);
}

.status-pill.status-rejected {
  color: var(--danger);
  background: rgba(180, 35, 24, 0.12);
}

.status-pill.status-info {
  color: var(--blue);
  background: rgba(23, 92, 211, 0.12);
}

.status-pill.status-warning {
  color: var(--orange);
  background: rgba(181, 71, 8, 0.14);
}

.status-pill.status-critical {
  color: var(--danger);
  background: rgba(180, 35, 24, 0.12);
}

.status-pill.status-owner,
.status-pill.status-admin {
  color: var(--accent-dark);
  background: rgba(99, 91, 255, 0.12);
}

.status-pill.status-employee {
  color: var(--blue);
  background: rgba(23, 92, 211, 0.12);
}

.status-pill.status-read_only {
  color: var(--orange);
  background: rgba(181, 71, 8, 0.14);
}

.calendar-surface {
  display: grid;
  gap: 18px;
}

.booking-request-grid {
  display: grid;
  gap: 18px;
}

.booking-request-message {
  min-width: 180px;
  max-width: 320px;
  white-space: pre-wrap;
}

.conversation-list,
.conversation-messages {
  display: grid;
  gap: 10px;
}

.conversation-card {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.conversation-card.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.conversation-card strong,
.message-bubble strong {
  display: block;
  margin-bottom: 4px;
}

.conversation-card span,
.message-bubble span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.conversation-messages {
  max-height: 420px;
  min-height: 220px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.message-bubble {
  max-width: 78%;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  white-space: pre-wrap;
}

.message-bubble.is-own {
  justify-self: end;
  background: var(--accent-soft);
  border-color: rgba(23, 107, 82, 0.2);
}

.reports-surface,
.reports-grid,
.reports-columns,
.reports-filter-bar,
.reports-bars,
.reports-tag-list,
.reports-print-layout {
  display: grid;
}

.reports-surface,
.reports-grid {
  gap: 18px;
}

.reports-filter-bar {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}

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

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

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

.reports-table-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-subtle);
}

.reports-table-card h4 {
  margin: 0 0 12px;
  font-size: 0.9rem;
}

.notification-list,
.attachment-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.notification-card,
.attachment-card,
.label-qr-placeholder {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-subtle);
}

.notification-card {
  display: grid;
  gap: 8px;
}

.notification-card header,
.attachment-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.notification-meta,
.attachment-meta {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.notifications-panel {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 20;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.label-qr-placeholder {
  display: grid;
  gap: 6px;
  place-items: center;
  min-height: 180px;
  margin-top: 16px;
  text-align: center;
}

.attachment-card {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.attachment-card.is-primary-image {
  border-color: var(--accent);
}

.attachment-title-line {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.attachment-primary-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
}

.attachment-order-actions {
  display: flex;
  min-width: 0;
  flex: 1 1 100%;
  flex-wrap: wrap;
  gap: 6px;
}

.attachment-order-button {
  flex: 1 1 150px;
  white-space: normal;
}

.attachment-preview {
  max-width: 100%;
  max-height: 180px;
  border-radius: 8px;
  object-fit: cover;
}

@media (max-width: 640px) {
  .attachment-card header {
    align-items: stretch;
    flex-direction: column;
  }

  .attachment-card .row-actions,
  .attachment-order-actions {
    width: 100%;
  }

  .attachment-card .row-actions > button,
  .attachment-order-button {
    min-width: 0;
    flex: 1 1 130px;
  }
}

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

.label-card {
  min-height: 320px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  break-inside: avoid;
  page-break-inside: avoid;
}

.reports-tag-list {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.reports-tag {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}

.reports-bar {
  display: grid;
  gap: 6px;
}

.reports-bar + .reports-bar {
  margin-top: 10px;
}

.reports-bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.reports-bar-track {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #edf1f7;
}

.reports-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--blue));
}

.reports-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.return-items-list {
  display: grid;
  gap: 12px;
}

.return-item-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-subtle);
}

.return-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.return-item-status {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.calendar-toolbar,
.calendar-controls,
.calendar-legend {
  display: flex;
  align-items: center;
}

.calendar-toolbar {
  justify-content: space-between;
  gap: 16px;
}

.calendar-controls {
  gap: 8px;
}

.calendar-controls button:first-child,
.calendar-controls button:last-child {
  width: 40px;
  padding: 0;
  font-size: 1rem;
}

.calendar-filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.calendar-search-field {
  grid-column: span 2;
}

.calendar-legend {
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-subtle);
  font-size: 0.78rem;
  font-weight: 750;
}

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

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
}

.calendar-reserved {
  color: #b54708;
}

.calendar-rented {
  color: #175cd3;
}

.calendar-planned {
  color: #7f56d9;
}

.calendar-in_progress {
  color: #026aa2;
}

.calendar-completed {
  color: #0f8f64;
}

.calendar-cancelled {
  color: #b42318;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 310px);
  gap: 18px;
  align-items: start;
}

.calendar-board {
  min-width: 0;
  overflow-x: auto;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(100px, 1fr));
  min-width: 700px;
}

.calendar-weekdays {
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: var(--panel-subtle);
}

.calendar-weekdays span {
  padding: 9px 10px;
  color: var(--soft);
  font-size: 0.7rem;
  font-weight: 850;
  text-align: center;
  text-transform: uppercase;
}

.calendar-grid {
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.calendar-day {
  position: relative;
  min-height: 124px;
  padding: 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  cursor: pointer;
  outline: none;
}

.calendar-day:hover,
.calendar-day:focus-visible {
  background: #fafaff;
}

.calendar-day.is-selected {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.calendar-day.is-outside {
  background: #fafbfc;
}

.calendar-day.is-outside .calendar-day-number {
  color: var(--soft);
}

.calendar-day.is-today .calendar-day-number {
  color: #ffffff;
  background: var(--accent);
}

.calendar-day-number {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.calendar-cell-events {
  display: grid;
  gap: 5px;
  margin-top: 6px;
}

button.calendar-event {
  display: block;
  min-height: 25px;
  width: 100%;
  padding: 4px 7px;
  border: 0;
  border-left: 3px solid currentColor;
  border-radius: 5px;
  color: var(--ink);
  background: #f4f5f7;
  box-shadow: none;
  font-size: 0.7rem;
  font-weight: 750;
  line-height: 1.25;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.calendar-event:hover {
  border-color: currentColor;
  color: var(--ink);
  box-shadow: none;
  filter: brightness(0.98);
}

button.calendar-event.calendar-reserved {
  color: #8a3707;
  background: #fff5eb;
}

button.calendar-event.calendar-rented {
  color: #164c9f;
  background: #eff6ff;
}

button.calendar-event.calendar-planned {
  color: #6941c6;
  background: #f4f3ff;
}

button.calendar-event.calendar-in_progress {
  color: #026aa2;
  background: #f0f9ff;
}

button.calendar-event.calendar-completed {
  color: #087443;
  background: #ecfdf3;
}

button.calendar-event.calendar-cancelled {
  color: #b42318;
  background: #fef3f2;
}

.calendar-more {
  padding-left: 8px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}

.calendar-day-panel {
  position: sticky;
  top: 18px;
  min-height: 250px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-subtle);
}

.calendar-day-events {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

button.calendar-day-event {
  display: grid;
  gap: 5px;
  min-height: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid currentColor;
  color: var(--ink);
  background: #ffffff;
  box-shadow: none;
  text-align: left;
}

button.calendar-day-event:hover {
  border-color: var(--line-strong);
  border-left-color: currentColor;
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(18, 20, 23, 0.06);
}

button.calendar-day-event.calendar-reserved {
  border-left-color: #b54708;
}

button.calendar-day-event.calendar-rented {
  border-left-color: #175cd3;
}

button.calendar-day-event.calendar-planned {
  border-left-color: #7f56d9;
}

button.calendar-day-event.calendar-in_progress {
  border-left-color: #026aa2;
}

button.calendar-day-event.calendar-completed {
  border-left-color: #0f8f64;
}

button.calendar-day-event.calendar-cancelled {
  border-left-color: #b42318;
}

.calendar-day-event strong,
.calendar-day-event span {
  display: block;
}

.calendar-day-event strong {
  font-size: 0.85rem;
}

.calendar-day-event span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
  line-height: 1.4;
}

.calendar-day-events .empty {
  margin-top: 0;
}

.settings-block {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-subtle);
}

.account-danger-zone {
  margin-top: 18px;
  border-color: color-mix(in srgb, var(--danger) 42%, transparent);
}

.account-deletion-list {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  background: #f7f8fb;
}

.account-deletion-list ul {
  margin: 0;
  padding-left: 20px;
}

.account-deletion-list li + li {
  margin-top: 8px;
}

.account-deletion-confirmation {
  display: grid;
  gap: 14px;
}

.account-deletion-entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.account-owner-guidance {
  margin: 12px 0;
  padding: 14px;
  border: 1px solid #e2a84a;
  border-radius: 12px;
  background: #fff7e8;
  color: #704313;
}

.account-owner-guidance p {
  margin: 0;
}

.account-owner-guidance p + p {
  margin-top: 8px;
}

.account-deletion-dialog {
  width: min(620px, calc(100vw - 32px));
}

@media (max-width: 480px) {
  .account-danger-zone,
  .account-deletion-dialog {
    overflow-wrap: anywhere;
  }

  .account-deletion-dialog .dialog-actions {
    align-items: stretch;
  }

  .account-deletion-dialog .dialog-actions button {
    width: 100%;
  }

  .account-deletion-entry-actions > * {
    width: 100%;
  }
}

.settings-logo-panel,
.settings-summary-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.settings-logo-preview {
  max-width: 100%;
  max-height: 180px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f7f8fb);
  object-fit: contain;
}

.settings-summary-surface {
  display: grid;
  gap: 16px;
  align-content: start;
}

.empty {
  margin-top: 16px;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-subtle);
}

.selection-fieldset {
  margin: 0;
  padding: 10px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.selection-list {
  display: grid;
  gap: 10px;
  max-height: 220px;
  padding-top: 8px;
  overflow-y: auto;
}

.selection-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.selection-option input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.selection-option-text {
  display: grid;
  gap: 4px;
}

.selection-option-text strong {
  font-size: 0.9rem;
}

.selection-option-text span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.message {
  min-height: 22px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.message.error {
  color: var(--danger);
}

.read-only-banner {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(181, 71, 8, 0.2);
  border-radius: 8px;
  color: var(--orange);
  background: #fff8f1;
  font-size: 0.84rem;
  font-weight: 750;
}

.print-page {
  background: #eef2f7;
}

.print-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 18px 42px;
}

.print-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.print-document {
  min-height: calc(297mm - 24mm);
}

.document-header,
.document-grid,
.document-signatures,
.document-section-heading {
  display: flex;
}

.document-header,
.document-section-heading {
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.document-header {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.document-meta {
  display: grid;
  gap: 8px;
  justify-items: end;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: right;
}

.document-grid {
  gap: 16px;
  margin-bottom: 16px;
}

.document-grid > * {
  flex: 1 1 0;
}

.document-grid-bottom {
  align-items: stretch;
}

.document-card,
.signature-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.document-card h3,
.signature-card h3 {
  margin-bottom: 14px;
}

.document-details,
.document-totals {
  display: grid;
  gap: 10px;
  margin: 0;
}

.document-details div,
.document-totals div {
  display: grid;
  grid-template-columns: minmax(120px, 0.42fr) minmax(0, 1fr);
  gap: 12px;
}

.document-details-single div {
  grid-template-columns: minmax(110px, 0.22fr) minmax(0, 1fr);
}

.document-details dt,
.document-totals dt {
  color: var(--soft);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.document-details dd,
.document-totals dd {
  margin: 0;
  color: var(--ink);
  font-size: 0.94rem;
  line-height: 1.5;
}

.document-notes {
  min-height: 96px;
  margin: 0;
  color: var(--ink);
  line-height: 1.6;
  white-space: pre-wrap;
}

.print-table {
  margin-top: 0;
}

.document-total dt,
.document-total dd {
  font-weight: 900;
}

.document-signatures {
  gap: 16px;
  margin-top: 16px;
}

.signature-card {
  flex: 1 1 0;
}

.signature-line {
  height: 56px;
  margin-top: 26px;
  border-bottom: 1px solid var(--ink);
}

.signature-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.is-hidden {
  display: none !important;
}

/* Mobilmeny og mobiloppsett */
@media (max-width: 960px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-shell.is-authenticated {
    display: block;
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
  }

  .app-shell.is-authenticated .main-area {
    width: 100%;
    min-width: 0;
    margin: 0;
  }

  .app-shell.is-authenticated .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1100;
    display: flex;
    width: min(86vw, 320px);
    height: 100dvh;
    padding: 20px 14px;
    overflow-x: hidden;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    background: #ffffff;
    box-shadow: 12px 0 32px rgb(15 23 42 / 18%);
  }

  .app-shell.is-authenticated.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
    visibility: hidden;
    pointer-events: none;
  }

  .app-shell.is-authenticated:not(.sidebar-collapsed)::after {
    position: fixed;
    inset: 0;
    z-index: 1050;
    content: "";
    background: rgb(15 23 42 / 42%);
  }

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

  .topbar {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    width: 100%;
  }

  .topbar-left {
    min-width: 0;
  }

  .topbar-left h1 {
    min-width: 0;
    overflow: hidden;
    font-size: 1.65rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-center {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .top-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

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

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

  .calendar-day-panel {
    position: static;
  }

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

@media (max-width: 720px) {
  img,
  svg {
    max-width: 100%;
    height: auto;
  }

  .main-area {
    padding: 20px 16px 36px;
  }

  .topbar,
  .dashboard-heading,
  .section-heading,
  .top-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .field-grid,
  .filter-bar,
  .calendar-filter-bar,
  .price-grid,
  .summary-grid,
  .label-grid,
  .reports-columns,
  .reports-columns-wide,
  .reports-summary-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .metric-grid,
  .metric-grid-wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .metric-card {
    min-height: 72px;
    padding: 10px;
  }

  .metric-card p {
    font-size: 0.65rem;
  }

  .metric-card strong {
    margin-top: 6px;
    font-size: 1.4rem;
  }

  .calendar-search-field {
    grid-column: auto;
  }

  .calendar-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .auth-copy {
    min-height: 220px;
    padding: 28px 22px;
  }

  .metric-grid > *,
  .metric-grid-wide > * {
    min-height: 0;
  }

  .surface,
  .panel,
  .card {
    min-width: 0;
    max-width: 100%;
  }

  .overview-grid,
  .work-grid,
  .dashboard-actions-grid,
  .settings-grid,
  .users-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .overview-grid > *,
  .work-grid > *,
  .dashboard-actions-grid > *,
  .settings-grid > *,
  .users-grid > * {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .notification-card,
  .attachment-card {
    width: 100%;
    min-width: 0;
  }

  .table-wrap {
    overflow: visible;
  }

  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table {
    min-width: 0;
  }

  .responsive-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .responsive-table tbody {
    display: grid;
    gap: 12px;
  }

  .responsive-table tbody tr {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
  }

  .responsive-table tbody td {
    display: grid;
    grid-template-columns: minmax(88px, 0.36fr) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    min-width: 0;
    padding: 11px 12px;
    overflow-wrap: anywhere;
    border-bottom: 1px solid var(--line);
  }

  .responsive-table tbody td:last-child {
    border-bottom: 0;
  }

  .responsive-table tbody td::before {
    min-width: 0;
    color: var(--soft);
    content: attr(data-label);
    font-size: 0.7rem;
    font-weight: 850;
    letter-spacing: 0.03em;
    overflow-wrap: anywhere;
    text-transform: uppercase;
  }

  .responsive-table tbody td[colspan] {
    display: block;
  }

  .responsive-table tbody td[colspan]::before {
    display: none;
  }

  .print-page .table-wrap {
    max-width: 100%;
    overflow-x: auto;
  }

  .print-page .print-table {
    min-width: 640px;
  }

  .row-actions,
  .booking-request-message {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .row-actions {
    justify-content: flex-start;
  }

  .notification-card header,
  .attachment-card header,
  .return-item-header,
  .print-toolbar,
  .document-header,
  .document-grid,
  .document-signatures,
  .document-section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .document-meta {
    justify-items: start;
    text-align: left;
  }

  .document-details div,
  .document-details-single div,
  .document-totals div {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .notifications-panel {
    inset: 8px;
    width: auto;
    max-height: calc(100dvh - 16px);
    padding: 14px;
  }

  .message-bubble,
  .selection-option-text,
  .booking-request-message,
  h1,
  h2,
  h3,
  p,
  dd,
  td,
  a {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .message-bubble {
    max-width: 100%;
  }

  .calendar-board {
    /* Kalenderen er reelt tabellarisk og beholder kontrollert scrolling. */
    max-width: 100%;
  }
}

@media (max-width: 420px) {
  .main-area,
  .print-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  .topbar-left h1 {
    overflow: visible;
    font-size: 1.45rem;
    text-overflow: clip;
    white-space: normal;
  }

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

  .form-actions,
  .quick-actions,
  .dialog-actions,
  .top-actions,
  .row-actions {
    width: 100%;
    flex-direction: column;
  }

  .form-actions > *,
  .quick-actions > *,
  .dialog-actions > *,
  .top-actions > *,
  .row-actions > * {
    width: 100%;
  }

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

  .app-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    padding: 16px;
  }

  .responsive-table tbody td {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }
}

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  body.print-page {
    background: #ffffff;
  }

  .no-print {
    display: none !important;
  }

  .print-shell {
    max-width: none;
    padding: 0;
  }

  .print-document,
  .document-card,
  .signature-card,
  .label-card,
  .label-qr-placeholder {
    box-shadow: none;
  }

  .document-card,
  .signature-card,
  .label-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
