:root {
    --bg: #f6f3f2;
    --bg-accent: #ffffff;
    --panel: rgba(255, 255, 255, 0.82);
    --panel-strong: #ffffff;
    --ink: #191516;
    --muted: #726468;
    --line: rgba(116, 78, 86, 0.15);
    --accent: #d62839;
    --accent-strong: #a51d2d;
    --accent-soft: rgba(196, 196, 196, 0.16);
    --accent-contrast: #fff7f7;
    --danger: #a51d2d;
    --success: #0f8a5f;
    --shadow: 0 24px 70px rgba(35, 21, 24, 0.08);
    --sidebar-top: #fff7f7;
    --sidebar-bottom: #f1e8e8;
    --sidebar-link: rgba(214, 40, 57, 0.07);
    --sidebar-link-hover: rgba(214, 40, 57, 0.14);
    --sidebar-ink: #2a171a;
    --sidebar-muted: #7c5e65;
    --sidebar-border: rgba(116, 78, 86, 0.12);
    --sidebar-button-bg: rgba(214, 40, 57, 0.08);
    --sidebar-button-hover: rgba(214, 40, 57, 0.14);
    --chip: rgba(214, 40, 57, 0.1);
    --topbar: rgba(255, 255, 255, 0.58);
}

body[data-theme="dark"] {
    --bg: #181315;
    --bg-accent: #1d1d1d;
    --panel: rgba(41, 33, 36, 0.86);
    --panel-strong: #34292d;
    --ink: #f7eff1;
    --muted: #c5b1b7;
    --line: rgba(255, 255, 255, 0.12);
    --accent: #c31e2d;
    --accent-strong: #e9091c;
    --accent-soft: rgba(111, 111, 111, 0.16);
    --accent-contrast: #fff6f7;
    --danger: #a51d2d;
    --success: #3dd598;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    --sidebar-top: #1d1518;
    --sidebar-bottom: #2b2b2b;
    --sidebar-link: rgba(255, 255, 255, 0.08);
    --sidebar-link-hover: rgba(255, 255, 255, 0.14);
    --sidebar-ink: #f8e9ec;
    --sidebar-muted: rgba(255, 255, 255, 0.62);
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-button-bg: rgba(255, 255, 255, 0.08);
    --sidebar-button-hover: rgba(255, 255, 255, 0.14);
    --chip: rgba(255, 77, 93, 0.14);
    --topbar: rgba(48, 39, 43, 0.76);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body[data-theme="dark"] { color-scheme: dark; }
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}
body {
    margin: 0;
    font-family: "Manrope", "Segoe UI", sans-serif;
    font-size: 14px;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(214, 40, 57, 0.16), transparent 24%),
        radial-gradient(circle at 85% 15%, rgba(214, 40, 57, 0.08), transparent 18%),
        linear-gradient(180deg, var(--bg-accent), var(--bg));
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}
body[data-theme="dark"] {
    background:
        radial-gradient(circle at top left, rgba(255, 77, 93, 0.18), transparent 26%),
        radial-gradient(circle at 84% 14%, rgba(255, 107, 120, 0.08), transparent 18%),
        linear-gradient(180deg, var(--bg-accent), var(--bg));
}
a { color: var(--accent); text-decoration: none; }
label {
    display: grid;
    gap: 0.45rem;
}
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.1rem 0;
}
.checkbox-row span {
    line-height: 1.35;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.native-select {
    display: none;
}
.custom-select {
    position: relative;
}
.custom-select-trigger {
    padding-right: 2.75rem;
    text-align: left;
    font-weight: 500;
}
.custom-select::after {
    content: "\f078";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    right: 1rem;
    top: 1.15rem;
    color: var(--muted);
    pointer-events: none;
    font-size: 0.82rem;
}
.custom-select-dropdown {
    position: fixed;
    display: grid;
    gap: 0.35rem;
    max-height: 260px;
    padding: 0.5rem;
    overflow-y: auto;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--panel-strong);
    box-shadow: var(--shadow);
}
.custom-select-dropdown[hidden] {
    display: none;
}
.custom-select-search {
    min-height: 38px;
}
.custom-select-options {
    display: grid;
    gap: 0.35rem;
}
.custom-select-option,
.custom-select-empty {
    width: 100%;
    min-height: 0;
    padding: 0.7rem 0.8rem;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink);
    text-align: left;
}
.custom-select-option:hover,
.custom-select-option.is-active {
    background: var(--accent-soft);
    border-color: rgba(214, 40, 57, 0.16);
}
.custom-select-empty {
    color: var(--muted);
}
input, textarea, select, button {
    font: inherit;
    width: 100%;
    padding: 0.72rem 0.9rem;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--panel-strong);
    color: var(--ink);
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
input[type="checkbox"],
input[type="radio"] {
    width: 1.15rem;
    height: 1.15rem;
    padding: 0;
    margin: 0;
    border-radius: 0.35rem;
    accent-color: var(--accent);
    flex: 0 0 1.15rem;
    box-shadow: none;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: rgba(214, 40, 57, 0.4);
    box-shadow: 0 0 0 4px rgba(214, 40, 57, 0.12);
}
button { cursor: pointer; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.75rem 0.65rem; text-align: left; border-bottom: 1px solid var(--line); }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

.shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; width: 100%; max-width: 100%; transition: grid-template-columns 0.24s ease; }
.sidebar {
    position: relative;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.1), transparent 28%),
        linear-gradient(180deg, var(--sidebar-top), var(--sidebar-bottom));
    color: var(--sidebar-ink);
    padding: 1.5rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 1.45rem;
    border-right: 1px solid var(--sidebar-border);
    transition: padding 0.24s ease;
}
.shell > * {
    min-width: 0;
}
.brand-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}
.brand-logo {
    display: block;
    width: 172px;
    max-width: 100%;
    height: auto;
}
.brand .muted { color: var(--sidebar-muted); }
.nav { display: grid; gap: 0.4rem; }
.nav a {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--sidebar-ink);
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    background: var(--sidebar-link);
    border: 1px solid transparent;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.nav a:hover {
    transform: translateX(2px);
    background: var(--sidebar-link-hover);
    border-color: var(--sidebar-border);
}
.nav-icon {
    width: 1.1rem;
    text-align: center;
    font-size: 0.95rem;
    opacity: 0.95;
    flex-shrink: 0;
}
.nav-icon i {
    display: inline-block;
}
.sidebar-collapse-toggle {
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 14px;
    border: 1px solid var(--sidebar-border);
    background: var(--sidebar-button-bg);
    color: var(--sidebar-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
}
.sidebar-collapse-toggle:hover {
    background: var(--sidebar-button-hover);
}
.sidebar-collapse-toggle i {
    transition: transform 0.24s ease;
}
.main { padding: 1.35rem; min-width: 0; max-width: 100%; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--topbar);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
}
body[data-theme="dark"] .topbar {
    border-color: rgba(255, 255, 255, 0.14);
}
.page-title strong {
    font-size: 1.05rem;
    letter-spacing: -0.04em;
}
.topbar-start {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
    max-width: 100%;
}
.page-title {
    min-width: 0;
}
.page-title strong {
    display: block;
    overflow-wrap: anywhere;
}
.topbar-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.mobile-nav-toggle,
.mobile-nav-close,
.sidebar-overlay {
    display: none;
}
.mobile-nav-toggle,
.mobile-nav-close {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--panel-strong);
    color: var(--ink);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.mobile-nav-toggle i,
.mobile-nav-close i {
    font-size: 1rem;
}
@media (min-width: 1025px) {
    body.sidebar-collapsed .shell {
        grid-template-columns: 92px 1fr;
    }
    body.sidebar-collapsed .sidebar {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }
    body.sidebar-collapsed .brand-head {
        justify-content: center;
    }
    body.sidebar-collapsed .brand .muted,
    body.sidebar-collapsed .nav a span:not(.nav-icon) {
        display: none;
    }
    body.sidebar-collapsed .nav a {
        justify-content: center;
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }
    body.sidebar-collapsed .nav a:hover {
        transform: none;
    }
    body.sidebar-collapsed .nav-icon {
        width: auto;
        font-size: 1rem;
    }
    body.sidebar-collapsed .sidebar-collapse-toggle i {
        transform: rotate(180deg);
    }
}
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 1rem;
    margin-bottom: 0.8rem;
    position: relative;
    overflow: visible;
    z-index: 1;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}
.card.has-open-select {
    z-index: 1;
}
.card.is-busy,
form.is-busy {
    position: relative;
}
.integration-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    gap: 0.75rem;
    background: rgba(20, 14, 16, 0.52);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: inherit;
    text-align: center;
    color: var(--accent-contrast);
    font-weight: 700;
}
.integration-loading-spinner {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 3px solid rgba(255, 255, 255, 0.18);
    border-top-color: var(--accent-contrast);
    animation: integration-spin 0.8s linear infinite;
}
.integration-loading-text {
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}
@keyframes integration-spin {
    to { transform: rotate(360deg); }
}
body[data-theme="dark"] .card {
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24);
}
.grid > .card,
.stack > .card,
.detail > .card,
.two-col > .card,
.three > .card,
.stats > .card,
.ticket-secondary-grid > .card {
    margin-bottom: 0;
}
.card,
.chat-window,
.chat-thread,
.filter-bar,
.filter-actions,
.section-head,
.attachment-item,
.ticket-pill-group,
.meta-grid,
.stack,
.stack.two {
    min-width: 0;
    max-width: 100%;
}
.grid { display: grid; gap: 0.8rem; margin-bottom: 0.8rem; }
.stats { grid-template-columns: repeat(4, 1fr); }
.three { grid-template-columns: repeat(3, 1fr); }
.two-col { grid-template-columns: repeat(2, 1fr); }
.detail { grid-template-columns: 2fr 1fr; align-items: start; }
.chat-card {
    padding: 0.95rem;
}
.ticket-hero {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 1rem;
    margin-bottom: 1rem;
}
.ticket-hero h2 {
    margin: 0.35rem 0 0.2rem;
    font-size: 1.6rem;
    letter-spacing: -0.05em;
}
.ticket-kicker {
    display: inline-block;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.ticket-meta {
    margin-bottom: 1rem;
}
.chat-window {
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    gap: 1rem;
    padding: 1rem;
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.38), rgba(255,255,255,0.2)),
        radial-gradient(circle at top right, var(--accent-soft), transparent 34%);
    border: 1px solid var(--line);
}
body[data-theme="dark"] .chat-window {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.025)),
        radial-gradient(circle at top right, var(--accent-soft), transparent 34%);
}
.chat-thread {
    display: grid;
    gap: 0.9rem;
    min-height: 0;
    min-height: 58vh;
    max-height: 68vh;
    overflow-y: auto;
    padding-right: 0.35rem;
}
.chat-thread::-webkit-scrollbar {
    width: 10px;
}
.chat-thread::-webkit-scrollbar-thumb {
    background: rgba(124, 106, 110, 0.28);
    border-radius: 999px;
}
body[data-theme="dark"] .chat-thread::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
}
.chat-search-bar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}
.chat-search-bar input {
    flex: 1;
}
.chat-search-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.chat-empty-state {
    padding: 1rem;
    border-radius: 18px;
    border: 1px dashed var(--line);
    background: rgba(124, 106, 110, 0.04);
}
.attachment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.9rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--line);
}
.attachment-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}
.attachment-item strong {
    display: block;
}
.chat-row {
    display: flex;
    align-items: flex-end;
    gap: 0.8rem;
    max-width: 88%;
    min-width: 0;
}
.chat-row-self {
    margin-left: auto;
    flex-direction: row-reverse;
}
.chat-row-customer {
    margin-right: auto;
}
.chat-row-support {
    margin-right: auto;
}
.chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 0.95rem;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--accent), var(--accent-strong));
    color: var(--accent-contrast);
    box-shadow: 0 10px 24px rgba(214, 40, 57, 0.2);
}
.chat-row-customer .chat-avatar {
    background: linear-gradient(180deg, #7c6a6e, #5f5054);
    box-shadow: none;
}
.chat-bubble {
    width: 100%;
    min-width: 0;
    padding: 1rem 1rem 0.95rem;
    border-radius: 24px;
    background: var(--panel-strong);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}
.chat-row-self .chat-bubble {
    background: linear-gradient(180deg, var(--accent-soft), rgba(255,255,255,0.7));
}
body[data-theme="dark"] .chat-row-self .chat-bubble {
    background: linear-gradient(180deg, rgba(255,77,93,0.16), rgba(255,255,255,0.02));
}
.chat-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.55rem;
    font-size: 0.9rem;
}
.chat-bubble p {
    margin: 0;
    line-height: 1.6;
    overflow-wrap: anywhere;
}
mark {
    background: rgba(255, 211, 105, 0.6);
    color: inherit;
    border-radius: 0.35rem;
    padding: 0 0.15rem;
}
body[data-theme="dark"] mark {
    background: rgba(255, 211, 105, 0.28);
}
.chat-composer {
    margin-top: 0.25rem;
}
.chat-composer-fields {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.85rem;
    align-items: end;
}
.chat-composer textarea {
    min-height: 108px;
    resize: vertical;
}
.ticket-secondary-grid {
    grid-template-columns: repeat(3, 1fr);
}
.stat {
    position: relative;
    overflow: hidden;
}
.stat::after {
    content: "";
    position: absolute;
    inset: auto -30px -40px auto;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-soft), transparent 68%);
}
.stat span {
    color: var(--muted);
    font-size: 0.9rem;
}
.stat strong { display: block; font-size: 2rem; margin-top: 0.5rem; letter-spacing: -0.05em; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-height: 44px;
    background: var(--accent);
    color: var(--accent-contrast);
    border: none;
    padding: 0.82rem 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12);
    border-radius: 15px;
    line-height: 1;
    white-space: nowrap;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.btn:hover {
    background: var(--accent-strong);
    transform: translateY(-1px);
}
.btn.secondary {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
    box-shadow: none;
}
.btn.secondary:hover {
    background: var(--accent-soft);
    border-color: rgba(214, 40, 57, 0.22);
}
.btn.danger {
    background: var(--danger);
    color: #fff;
}
.btn.danger:hover {
    background: #b42318;
}
.btn-sm {
    min-height: 38px;
    padding: 0.62rem 0.9rem;
    border-radius: 12px;
    font-size: 0.86rem;
}
.btn-block {
    width: auto;
    justify-self: start;
}
.table-wrap .btn {
    vertical-align: middle;
}
.table-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table-wrap table {
    min-width: 720px;
}
.pagination-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}
.pagination-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}
.filter-bar {
    display: grid;
    grid-template-columns: minmax(280px, 2.2fr) repeat(3, minmax(150px, 1fr)) auto auto;
    gap: 0.9rem;
    margin: 1rem 0 1.25rem;
    align-items: end;
}
.filter-field {
    display: grid;
    gap: 0.4rem;
}
.filter-field span {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
}
.filter-field-wide {
    min-width: 0;
}
.filter-checkbox {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 44px;
    padding: 0.75rem 0.95rem;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--panel-strong);
    justify-self: start;
    align-self: end;
    margin: 0;
}
.filter-checkbox input {
    width: auto;
    margin: 0;
}
.filter-checkbox span {
    width: auto;
    font-size: 0.9rem;
    font-weight: 600;
}
.filter-actions {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
    align-self: end;
}
.stack { display: grid; gap: 1rem; }
.stack.two { grid-template-columns: repeat(2, 1fr); }
.stack .full { grid-column: 1 / -1; }
.assign-actions {
    gap: 0.45rem;
}
.soft {
    background: rgba(255, 255, 255, 0.55);
}
body[data-theme="dark"] .soft {
    background: rgba(255, 255, 255, 0.04);
}
.muted { color: var(--muted); }
.badge {
    display: inline-block;
    border-radius: 999px;
    background: var(--chip);
    color: var(--accent);
    padding: 0.35rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 700;
}
.ticket-pill-group {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.badge-status-open {
    background: rgba(59, 130, 246, 0.14);
    color: #1d4ed8;
}
.badge-status-planned {
    background: rgba(14, 165, 233, 0.14);
    color: #0369a1;
}
.badge-status-progress {
    background: rgba(249, 115, 22, 0.14);
    color: #c2410c;
}
.badge-status-waiting {
    background: rgba(168, 85, 247, 0.16);
    color: #7e22ce;
}
.badge-status-resolved {
    background: rgba(16, 185, 129, 0.16);
    color: #047857;
}
.badge-status-closed {
    background: rgba(107, 114, 128, 0.16);
    color: #4b5563;
}
.badge-status-default {
    background: rgba(124, 106, 110, 0.12);
    color: var(--muted);
}
.badge-priority-low {
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.26), rgba(22, 163, 74, 0.18));
    color: #166534;
    border: 1px solid rgba(34, 197, 94, 0.26);
}
.badge-priority-medium {
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.28), rgba(217, 119, 6, 0.18));
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.28);
}
.badge-priority-high {
    background: linear-gradient(180deg, rgba(249, 115, 22, 0.3), rgba(234, 88, 12, 0.2));
    color: #9a3412;
    border: 1px solid rgba(249, 115, 22, 0.28);
}
.badge-priority-critical {
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.32), rgba(220, 38, 38, 0.22));
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.badge-priority-default {
    background: rgba(214, 40, 57, 0.1);
    color: var(--accent);
}
body[data-theme="dark"] .badge-status-open { color: #93c5fd; }
body[data-theme="dark"] .badge-status-planned { color: #7dd3fc; }
body[data-theme="dark"] .badge-status-progress { color: #fdba74; }
body[data-theme="dark"] .badge-status-waiting { color: #d8b4fe; }
body[data-theme="dark"] .badge-status-resolved { color: #6ee7b7; }
body[data-theme="dark"] .badge-status-closed { color: #d1d5db; }
body[data-theme="dark"] .badge-priority-low {
    color: #bbf7d0;
    border-color: rgba(74, 222, 128, 0.26);
}
body[data-theme="dark"] .badge-priority-medium {
    color: #fde68a;
    border-color: rgba(251, 191, 36, 0.28);
}
body[data-theme="dark"] .badge-priority-high {
    color: #fdba74;
    border-color: rgba(251, 146, 60, 0.3);
}
body[data-theme="dark"] .badge-priority-critical {
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.34);
}
.history-pills {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    flex-wrap: wrap;
}
.inline-form {
    display: inline-flex;
    width: auto;
}
.inline-stack {
    display: inline-grid;
    gap: 0.5rem;
    width: 220px;
}
.inline-stack input,
.inline-stack button {
    width: 100%;
}
.history-arrow {
    color: var(--muted);
    font-weight: 700;
}
.tabs {
    display: grid;
    gap: 1rem;
}
.tabs-nav {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.35rem;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.34);
}
body[data-theme="dark"] .tabs-nav {
    background: rgba(255, 255, 255, 0.03);
}
.tab-button {
    width: auto;
    min-height: 42px;
    padding: 0.75rem 1rem;
    border-radius: 14px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
}
.tab-button.is-active {
    background: var(--panel-strong);
    color: var(--accent);
    border-color: rgba(214, 40, 57, 0.18);
    box-shadow: var(--shadow);
}
.tab-panel {
    display: block;
}
.tab-panel[hidden] {
    display: none;
}
.reply-banner {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 18px;
    background: var(--accent-soft);
    border: 1px solid var(--line);
}
.reply-indicator {
    display: inline-flex;
    align-items: center;
    width: auto;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(124, 106, 110, 0.12);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}
.reply-indicator-customer {
    background: var(--chip);
    color: var(--accent);
}
.reply-indicator-waiting {
    background: rgba(59, 130, 246, 0.14);
    color: #1d4ed8;
}
body[data-theme="dark"] .reply-indicator-waiting {
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.18);
}
.subtle-meta {
    margin-top: 0.3rem;
    color: var(--muted);
    font-size: 0.82rem;
}
.alert {
    padding: 1rem 1.1rem;
    border-radius: 18px;
    margin-bottom: 1rem;
    border: 1px solid var(--line);
    backdrop-filter: blur(10px);
}
.alert.success { background: rgba(2, 122, 72, 0.12); color: var(--success); }
.alert.error { background: rgba(180, 35, 24, 0.12); color: var(--danger); }
.toast-stack {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    display: grid;
    gap: 0.5rem;
    z-index: 10000;
    pointer-events: none;
}
.toast {
    min-width: 260px;
    max-width: min(420px, calc(100vw - 2rem));
    padding: 0.9rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--panel-strong);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
    color: var(--ink);
    transform: translateY(10px);
    opacity: 0;
    transition: opacity 0.22s ease, transform 0.22s ease;
}
.toast.is-visible {
    transform: translateY(0);
    opacity: 1;
}
.toast.is-success {
    border-color: rgba(15, 138, 95, 0.22);
    background: rgba(15, 138, 95, 0.10);
}
.toast.is-error {
    border-color: rgba(217, 45, 32, 0.22);
    background: rgba(217, 45, 32, 0.10);
}
.auth-card {
    max-width: 460px;
    margin: 5rem auto;
    padding: 2.2rem;
    border-radius: 30px;
    background: var(--panel);
    border: 1px solid var(--line);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
}
.meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.public-body {
    display: block;
}
.public-shell,
.offer-public-shell {
    width: min(100%, calc(100vw - 32px));
    margin: 0 auto;
}
.public-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin-bottom: 1.25rem;
}
.public-kicker,
.offer-kicker {
    display: inline-block;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.offer-public-card,
.offer-admin-layout > .card {
    padding: 1.1rem;
}
.offer-meta-grid,
.offer-summary-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.offer-summary-grid .card {
    padding: 0.85rem;
}
.offer-item-row {
    display: grid;
    grid-template-columns: 0.7fr 2fr 0.7fr 0.8fr 0.7fr;
    gap: 0.6rem;
    align-items: center;
}
.offer-action-row {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: start;
}
.offer-item-table th,
.offer-item-table td {
    white-space: nowrap;
}
.offer-admin-layout {
    align-items: start;
}
.code-block,
.prose {
    white-space: pre-wrap;
    word-break: break-word;
    font: inherit;
}
.code-block {
    margin: 0;
    padding: 0.9rem;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--panel-strong);
}
.timeline-item { padding: 0.95rem 0; border-bottom: 1px solid var(--line); }
.checks { display: flex; flex-wrap: wrap; gap: 1rem; }
.checks label, .inline {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    min-height: 1.15rem;
}
.checks label input,
.inline input {
    flex-shrink: 0;
}
.plain-list { list-style: none; margin: 1rem 0 0; padding: 0; }
.plain-list li { padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.82rem;
    word-break: break-word;
}
.inline-details {
    position: relative;
}
.inline-details summary {
    list-style: none;
}
.inline-details summary::-webkit-details-marker {
    display: none;
}
.details-card {
    margin-top: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel-strong);
    box-shadow: var(--shadow);
}

.timesheet-shell {
    display: grid;
    gap: 1rem;
}
.timesheet-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.timesheet-header {
    margin-bottom: 0;
}
.timesheet-hero-card {
    display: grid;
    gap: 1.25rem;
    padding: 1.25rem;
}
.timesheet-hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}
.timesheet-hero-range {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}
.timesheet-nav-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--panel-strong);
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 40px;
}
.timesheet-nav-icon:hover {
    border-color: rgba(214, 40, 57, 0.28);
    box-shadow: 0 0 0 4px rgba(214, 40, 57, 0.08);
}
.timesheet-hero-labels h3 {
    margin: 0;
    font-size: 1.25rem;
    letter-spacing: -0.03em;
}
.timesheet-hero-labels p {
    margin: 0.15rem 0 0;
}
.timesheet-hero-switch {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}
.timesheet-hero-switch .btn {
    width: auto;
    min-width: 72px;
}
.timesheet-hero-stats {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: center;
}
.timesheet-hero-donut {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    background: conic-gradient(var(--accent) 0 var(--progress), rgba(214, 40, 57, 0.12) var(--progress) 100%);
    display: grid;
    place-items: center;
    position: relative;
}
.timesheet-hero-donut::after {
    content: "";
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    background: var(--panel-strong);
}
.timesheet-hero-donut-inner {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    gap: 0.1rem;
    text-align: center;
}
.timesheet-hero-donut-inner strong {
    font-size: 1.2rem;
    line-height: 1;
}
.timesheet-hero-donut-inner span {
    font-size: 0.72rem;
    color: var(--muted);
}
.timesheet-hero-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}
.timesheet-hero-metric {
    display: grid;
    gap: 0.25rem;
}
.timesheet-hero-metric span,
.timesheet-hero-total span {
    color: var(--muted);
    font-size: 0.86rem;
}
.timesheet-hero-metric strong,
.timesheet-hero-total strong {
    font-size: 1.35rem;
    letter-spacing: -0.03em;
}
.timesheet-hero-total {
    display: grid;
    gap: 0.25rem;
    justify-items: end;
    text-align: right;
    min-width: 170px;
}
.timesheet-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.timesheet-period-nav {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}
.timesheet-period-label {
    display: grid;
    gap: 0.2rem;
}
.timesheet-period-label strong {
    font-size: 1.15rem;
    letter-spacing: -0.03em;
}
.timesheet-mode-switch {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}
.timesheet-mode-switch .btn {
    width: auto;
    min-width: 74px;
}
.timesheet-filter-bar {
    grid-template-columns: minmax(220px, 1.5fr) minmax(170px, 0.7fr) minmax(180px, 0.8fr) minmax(180px, 0.9fr) auto;
    align-items: end;
}
.timesheet-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}
.timesheet-summary-grid .stat strong {
    font-size: 1.8rem;
}
.timesheet-breakdown-card {
    display: grid;
    gap: 1rem;
}
.timesheet-breakdown-list {
    display: grid;
    gap: 0.85rem;
}
.timesheet-breakdown-row {
    display: grid;
    grid-template-columns: minmax(170px, 1fr) minmax(220px, 2fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.18);
}
.timesheet-breakdown-left {
    display: grid;
    gap: 0.2rem;
}
.timesheet-breakdown-left strong {
    font-size: 0.98rem;
}
.timesheet-breakdown-left span,
.timesheet-breakdown-right span {
    font-size: 0.82rem;
    color: var(--muted);
}
.timesheet-breakdown-center {
    display: grid;
    gap: 0.35rem;
}
.timesheet-breakdown-time {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    color: var(--ink);
    font-weight: 600;
}
.timesheet-breakdown-time span {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
}
.timesheet-breakdown-bar {
    display: flex;
    width: 100%;
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(214, 40, 57, 0.12);
}
.timesheet-breakdown-bar-billable {
    background: var(--accent);
}
.timesheet-breakdown-bar-nonbillable {
    background: rgba(214, 40, 57, 0.22);
}
.timesheet-breakdown-right {
    display: grid;
    gap: 0.2rem;
    justify-items: end;
    text-align: right;
    min-width: 120px;
}
.timesheet-breakdown-right strong {
    font-size: 1rem;
}
.timesheet-days {
    display: grid;
    gap: 1rem;
}
.timesheet-day-card {
    display: grid;
    gap: 0.9rem;
    padding: 1rem 1.05rem 1.1rem;
    border-radius: 24px;
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
}
.timesheet-day-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--line);
}
.timesheet-day-title {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}
.timesheet-day-title h3 {
    margin: 0;
    font-size: 1.1rem;
    letter-spacing: -0.03em;
}
.timesheet-day-meta {
    display: flex;
    justify-content: flex-end;
    gap: 0.45rem;
    flex-wrap: wrap;
}
.timesheet-day-window {
    display: grid;
    gap: 0.45rem;
    padding: 0.9rem 0.95rem;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.22);
}
.timesheet-day-window-head,
.timesheet-day-window-foot,
.timesheet-day-window-extra {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.timesheet-day-window-head {
    font-size: 0.8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.timesheet-day-window-labels {
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
}
.timesheet-day-window-bar {
    position: relative;
    height: 60px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(214, 40, 57, 0.04), rgba(214, 40, 57, 0.08), rgba(214, 40, 57, 0.04));
    border: 1px solid rgba(214, 40, 57, 0.14);
    overflow: visible;
}
.timesheet-day-window-work {
    position: absolute;
    top: 5px;
    bottom: 5px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(214, 40, 57, 0.08), rgba(214, 40, 57, 0.18));
}
.timesheet-day-window-entry {
    position: absolute;
    top: 5px;
    bottom: 5px;
    transform: translateX(0);
    border-radius: 16px;
    background: linear-gradient(90deg, rgba(214, 40, 57, 0.22), rgba(214, 40, 57, 0.5));
    border: 1px solid rgba(214, 40, 57, 0.16);
    color: #fff;
    padding: 0.55rem 1.05rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.18rem;
    min-width: 22px;
    overflow: visible;
    white-space: pre-line;
    text-align: left;
    cursor: grab;
    user-select: none;
    touch-action: none;
}
.timesheet-day-window-entry > strong,
.timesheet-day-window-entry > span:not(.timesheet-day-window-handle) {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.timesheet-day-window-entry::after {
    content: attr(data-entry-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 6px);
    transform: translateX(-50%);
    min-width: 180px;
    max-width: 280px;
    padding: 0.55rem 0.7rem;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(214, 40, 57, 0.98), rgba(165, 29, 45, 0.98));
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 14px 28px rgba(117, 16, 28, 0.28);
    font-size: 0.72rem;
    line-height: 1.35;
    white-space: pre-line;
    text-align: left;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.04s linear, visibility 0.04s linear;
    z-index: 8;
}
.timesheet-day-window-entry.is-compact:hover::after,
.timesheet-day-window-entry.is-compact:focus-visible::after {
    opacity: 1;
    visibility: visible;
}
.timesheet-day-window-entry.is-dragging {
    cursor: grabbing;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.16);
    z-index: 5;
}
.timesheet-day-window-entry.is-resizing {
    cursor: ew-resize;
    z-index: 5;
}
.timesheet-day-window-entry strong {
    font-size: 0.7rem;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}
.timesheet-day-window-entry span {
    font-size: 0.7rem;
    line-height: 1.1;
    opacity: 0.9;
    white-space: nowrap;
}
.timesheet-day-window-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 16px;
    z-index: 2;
    cursor: ew-resize;
    opacity: 0.78;
}
.timesheet-day-window-handle::before {
    content: "";
    position: absolute;
    top: 18%;
    bottom: 18%;
    width: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.6);
}
.timesheet-day-window-handle-start {
    left: 0;
}
.timesheet-day-window-handle-start::before {
    left: 5px;
}
.timesheet-day-window-handle-end {
    right: 0;
}
.timesheet-day-window-handle-end::before {
    right: 5px;
}
.timesheet-day-window-entry > strong,
.timesheet-day-window-entry > span:not(.timesheet-day-window-handle) {
    pointer-events: none;
}
.timesheet-day-window-entry.is-compact {
    padding-left: 0.45rem;
    padding-right: 0.45rem;
}
.timesheet-day-window-entry.is-compact > strong,
.timesheet-day-window-entry.is-compact > span:not(.timesheet-day-window-handle) {
    opacity: 0;
}
.timesheet-day-window-handle {
    pointer-events: auto;
}
.timesheet-day-window-foot {
    font-size: 0.78rem;
    color: var(--muted);
}
.timesheet-day-window-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.24);
    font-size: 0.78rem;
    color: var(--muted);
}
body[data-theme="dark"] .timesheet-day-window,
body[data-theme="dark"] .timesheet-day-window-chip {
    background: rgba(255, 255, 255, 0.06);
}
body[data-theme="dark"] .timesheet-day-window-entry {
    color: #fff;
}
.timesheet-project-stack {
    display: grid;
    gap: 0.7rem;
    margin-top: 0.8rem;
}
.timesheet-day-details {
    margin-top: 0.8rem;
}
.timesheet-day-details-summary {
    justify-content: space-between;
    text-align: left;
}
.timesheet-project-stack-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
}
.timesheet-project-list {
    display: grid;
    gap: 0.75rem;
}
.timesheet-project-card {
    display: grid;
    gap: 0.75rem;
    padding: 0.95rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.18);
}
.timesheet-project-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.timesheet-project-title {
    display: grid;
    gap: 0.2rem;
}
.timesheet-project-title strong {
    font-size: 0.96rem;
}
.timesheet-project-title span {
    font-size: 0.8rem;
    color: var(--muted);
}
.timesheet-project-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.timesheet-project-activities {
    display: grid;
    gap: 0.5rem;
}
.timesheet-project-activity {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 0.75rem;
    align-items: start;
    padding-top: 0.45rem;
    border-top: 1px dashed rgba(100, 82, 88, 0.18);
}
.timesheet-project-activity-time {
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 700;
}
.timesheet-project-activity-body {
    display: grid;
    gap: 0.12rem;
}
.timesheet-project-activity-body strong {
    font-size: 0.88rem;
}
.timesheet-project-activity-body span {
    font-size: 0.78rem;
    color: var(--muted);
}
body[data-theme="dark"] .timesheet-project-card {
    background: rgba(255, 255, 255, 0.05);
}
.projects-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.75rem 0.9rem;
}
.projects-hero h2 {
    margin-bottom: 0.2rem;
    font-size: 1.08rem;
}
.projects-hero-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.projects-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.8rem;
    margin-top: 0.8rem;
}
.projects-overview-layout {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 0.8rem;
    margin-top: 0.8rem;
}
.projects-sidebar,
.projects-main {
    display: grid;
    gap: 0.8rem;
}
.project-hardware-list {
    display: grid;
    gap: 0.6rem;
}
.project-hardware-row {
    display: grid;
    gap: 0.55rem;
    padding: 0.65rem 0;
    border-top: 1px solid var(--line);
}
.project-hardware-list > .project-hardware-row:first-child {
    border-top: 0;
    padding-top: 0;
}
.project-hardware-row-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.project-hardware-row-top {
    display: grid;
    gap: 0.18rem;
}
.project-hardware-row-top strong {
    font-size: 0.95rem;
}
.project-hardware-row-metrics {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}
.project-hardware-row-fields {
    display: grid;
    grid-template-columns: 88px minmax(220px, 1.8fr) minmax(170px, 1.2fr) 88px 110px 110px 88px minmax(180px, 1.3fr);
    gap: 0.45rem;
    align-items: center;
}
.project-hardware-row-fields input,
.project-hardware-row-fields select {
    min-width: 0;
}
.project-hardware-row-attachment {
    margin-top: -0.15rem;
}
.project-create-card {
    align-self: start;
}
.project-list-card-wrap {
    min-width: 0;
}
.project-create-card,
.project-list-card-wrap,
.projects-detail-top,
.projects-layout .card,
.projects-overview-layout .card {
    padding: 0.75rem;
}
.project-create-card .section-head,
.project-list-card-wrap .section-head,
.projects-detail-top,
.projects-detail-hero {
    gap: 0.6rem;
}
.project-create-card h2,
.project-list-card-wrap h2,
.projects-detail-hero h3,
.projects-detail-top .badge,
.projects-hero .badge {
    font-size: 0.92rem;
}
.project-list {
    display: grid;
    gap: 0.7rem;
}
.project-list-card {
    padding: 0.65rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.16);
    display: grid;
    gap: 0.8rem;
}
.project-list-card.is-selected {
    border-color: rgba(214, 40, 57, 0.28);
    box-shadow: 0 0 0 1px rgba(214, 40, 57, 0.08) inset;
}
.project-list-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.project-list-title {
    display: grid;
    gap: 0.2rem;
}
.project-list-title strong {
    font-size: 0.92rem;
}
.project-list-title span {
    font-size: 0.76rem;
    color: var(--muted);
}
.project-edit-form {
    padding-top: 0.5rem;
    border-top: 1px dashed rgba(100, 82, 88, 0.18);
}
.projects-detail-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 0.7rem;
}
.projects-detail-hero h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
}
.projects-detail-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
    min-width: min(100%, 460px);
}
.projects-detail-stats div,
.projects-detail-card {
    padding: 0.6rem 0.7rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.12);
}
.projects-detail-stats span,
.projects-detail-card span {
    display: block;
    font-size: 0.68rem;
    color: var(--muted);
    margin-bottom: 0.18rem;
}
.projects-detail-stats strong,
.projects-detail-card strong {
    font-size: 0.92rem;
}
.projects-detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.45rem;
    margin-top: 0.8rem;
}
.projects-note {
    margin-top: 0.8rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    border: 1px dashed var(--line);
    background: rgba(255, 255, 255, 0.12);
}
.projects-note strong {
    display: block;
    margin-bottom: 0.2rem;
}
.projects-detail-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 0.8rem;
}
.projects-detail-top-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}
body[data-theme="dark"] .project-list-card,
body[data-theme="dark"] .projects-detail-stats div,
body[data-theme="dark"] .projects-detail-card,
body[data-theme="dark"] .projects-note {
    background: rgba(255, 255, 255, 0.05);
}
.timesheet-day-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.26);
    font-size: 0.8rem;
    color: var(--muted);
}
.timesheet-day-inline-total {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(214, 40, 57, 0.18), rgba(214, 40, 57, 0.08));
    border: 1px solid rgba(214, 40, 57, 0.22);
    color: var(--accent-strong);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.timesheet-day-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}
.timesheet-day-title h3 {
    margin: 0;
}
.timesheet-day-meta .timesheet-day-chip:nth-child(1) {
    background: linear-gradient(135deg, rgba(214, 40, 57, 0.16), rgba(214, 40, 57, 0.08));
    border-color: rgba(214, 40, 57, 0.22);
    color: var(--accent-strong);
}
.timesheet-day-meta .timesheet-day-chip:nth-child(2) {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(34, 197, 94, 0.06));
    border-color: rgba(34, 197, 94, 0.18);
    color: #15803d;
}
.timesheet-day-meta .timesheet-day-chip:nth-child(3) {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(14, 165, 233, 0.06));
    border-color: rgba(14, 165, 233, 0.18);
    color: #0369a1;
}
.timesheet-day-meta .timesheet-day-chip:nth-child(4) {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.12), rgba(168, 85, 247, 0.06));
    border-color: rgba(168, 85, 247, 0.18);
    color: #7c3aed;
}
.timesheet-day-meta .timesheet-day-chip:nth-child(5) {
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.12), rgba(107, 114, 128, 0.06));
    border-color: rgba(107, 114, 128, 0.18);
    color: #4b5563;
}
.timesheet-day-meta .timesheet-day-chip:nth-child(6) {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(245, 158, 11, 0.06));
    border-color: rgba(245, 158, 11, 0.2);
    color: #b45309;
}
body[data-theme="dark"] .timesheet-day-chip {
    background: rgba(255, 255, 255, 0.06);
}
body[data-theme="dark"] .timesheet-day-inline-total {
    background: linear-gradient(135deg, rgba(255, 77, 93, 0.2), rgba(255, 77, 93, 0.08));
    border-color: rgba(255, 77, 93, 0.24);
    color: #ffd7db;
}
body[data-theme="dark"] .timesheet-day-meta .timesheet-day-chip:nth-child(1) {
    background: rgba(255, 77, 93, 0.16);
    border-color: rgba(255, 77, 93, 0.22);
    color: #ffd7db;
}
body[data-theme="dark"] .timesheet-day-meta .timesheet-day-chip:nth-child(2) {
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(34, 197, 94, 0.2);
    color: #bbf7d0;
}
body[data-theme="dark"] .timesheet-day-meta .timesheet-day-chip:nth-child(3) {
    background: rgba(14, 165, 233, 0.14);
    border-color: rgba(14, 165, 233, 0.2);
    color: #bae6fd;
}
body[data-theme="dark"] .timesheet-day-meta .timesheet-day-chip:nth-child(4) {
    background: rgba(168, 85, 247, 0.14);
    border-color: rgba(168, 85, 247, 0.2);
    color: #e9d5ff;
}
body[data-theme="dark"] .timesheet-day-meta .timesheet-day-chip:nth-child(5) {
    background: rgba(107, 114, 128, 0.14);
    border-color: rgba(107, 114, 128, 0.2);
    color: #e5e7eb;
}
body[data-theme="dark"] .timesheet-day-meta .timesheet-day-chip:nth-child(6) {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.2);
    color: #fde68a;
}
.timesheet-empty {
    padding: 1.25rem 0.85rem;
    text-align: center;
}
.timesheet-empty h3 {
    margin: 0 0 0.45rem;
}
.timesheet-status-stack {
    display: grid;
    gap: 0.35rem;
}
.timesheet-entry-title {
    font-weight: 600;
    line-height: 1.35;
}
.timesheet-entry-subtle {
    margin-top: 0.25rem;
    color: var(--muted);
    font-size: 0.82rem;
}
.timesheet-entry-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.timesheet-entry-grid > label {
    gap: 0.45rem;
}
.timesheet-billable-toggle {
    align-items: center;
    min-height: 100%;
}
.timesheet-billable-toggle span {
    line-height: 1.3;
}
.timesheet-form-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.timesheet-row-actions {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.timesheet-table td[data-label="Omschrijving"] {
    min-width: 220px;
}
.timesheet-table td[data-label="Actie"] .btn,
.timesheet-table td[data-label="Actie"] input {
    width: auto;
}
.inline-stack {
    display: grid;
    gap: 0.45rem;
}
.inline-stack input {
    min-width: 180px;
}
.timesheet-modal {
    width: min(920px, calc(100vw - 2rem));
    max-width: 920px;
    border: none;
    padding: 0;
    background: transparent;
    color: var(--ink);
    box-shadow: none;
}
.timesheet-modal::backdrop {
    background: rgba(12, 8, 10, 0.68);
    backdrop-filter: blur(8px);
}
.timesheet-modal-card {
    display: grid;
    gap: 1.2rem;
    padding: 1.35rem;
    border-radius: 28px;
    border: 1px solid var(--line);
    background: var(--panel-strong);
    box-shadow: var(--shadow);
}
.timesheet-delete-form {
    display: flex;
    justify-content: flex-end;
    margin-top: -0.25rem;
}
.project-delete-form {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.8rem;
}
.timesheet-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}
.timesheet-modal-head h2 {
    margin: 0;
    font-size: 1.35rem;
    letter-spacing: -0.03em;
}
.timesheet-modal-head .btn {
    width: auto;
    flex: 0 0 auto;
}
body.timesheet-modal-open {
    overflow: hidden;
}
.ticket-customer-picker {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.65rem;
    align-items: end;
}
.ticket-customer-picker .btn {
    width: auto;
    min-width: 42px;
    height: 42px;
    padding-inline: 0.85rem;
}
.ticket-customer-user-active {
    align-self: end;
    min-height: 42px;
}
.user-schedule-grid {
    display: grid;
    gap: 0.85rem;
}
.user-schedule-row {
    display: grid;
    gap: 0.5rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel);
}
.user-schedule-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}
.user-vacation-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
    margin-bottom: 1rem;
}
.user-vacation-stats div {
    display: grid;
    gap: 0.2rem;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--panel);
}
.user-vacation-stats span {
    color: var(--muted);
}
.user-vacation-stats strong {
    font-size: 1.1rem;
}
.timesheet-workload-stack {
    display: grid;
    gap: 0.85rem;
}
.timesheet-workload-summary {
    justify-content: space-between;
    text-align: left;
}
.timesheet-workload-card {
    display: grid;
    gap: 0.85rem;
}
.timesheet-workload-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.85rem;
}
.timesheet-workload-grid div {
    display: grid;
    gap: 0.2rem;
    padding: 0.85rem 0.95rem;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--panel);
}
.timesheet-workload-grid span {
    color: var(--muted);
}
.timesheet-workload-days {
    display: grid;
    gap: 0.6rem;
}
.timesheet-workload-day {
    display: grid;
    gap: 0.2rem;
    padding: 0.8rem 0.95rem;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--panel);
}
.timesheet-workload-day span {
    color: var(--muted);
}
.timesheet-fixed-free-list {
    display: grid;
    gap: 0.75rem;
}
.timesheet-fixed-free-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel);
}
.timesheet-fixed-free-item > div {
    display: grid;
    gap: 0.2rem;
}
.timesheet-fixed-free-checkbox {
    align-content: start;
}
.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 42px;
}

.theme-toggle {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--panel-strong);
    color: var(--ink);
}
.theme-toggle-track {
    width: 50px;
    height: 28px;
    border-radius: 999px;
    background: var(--accent-soft);
    position: relative;
    flex-shrink: 0;
}
.theme-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(180deg, var(--accent), var(--accent-strong));
    transition: transform 0.24s ease;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}
body[data-theme="dark"] .theme-toggle-thumb {
    transform: translateX(22px);
}
.theme-toggle-label {
    width: auto;
    font-size: 0.9rem;
    font-weight: 700;
}

@media (max-width: 1024px) {
    .sidebar-collapse-toggle {
        display: none;
    }
    .shell, .detail, .three, .two-col, .stack.two, .ticket-secondary-grid, .chat-composer-fields, .filter-bar { grid-template-columns: 1fr; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .shell {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 50;
        width: min(320px, 86vw);
        padding: 1.1rem;
        gap: 1rem;
        border-right: 0;
        border-bottom: 0;
        transform: translateX(calc(-100% - 24px));
        transition: transform 0.24s ease;
        overflow-y: auto;
    }
    body.nav-open {
        overflow: hidden;
    }
    body.nav-open .sidebar {
        transform: translateX(0);
    }
    .brand {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
    }
    .nav {
        display: grid;
        gap: 0.65rem;
        overflow: visible;
        padding-bottom: 0;
        scrollbar-width: auto;
    }
    .nav a {
        white-space: normal;
        flex: initial;
    }
    .main { padding: 1rem; }
    .topbar {
        flex-direction: column;
        align-items: start;
        gap: 1rem;
        position: relative;
        z-index: 1;
        width: 100%;
        max-width: 100%;
    }
    .topbar,
    .card,
    .auth-card {
        border-radius: 22px;
    }
    .topbar-start {
        width: 100%;
        max-width: 100%;
    }
    .topbar-actions {
        width: 100%;
        max-width: 100%;
        justify-content: space-between;
    }
    .mobile-nav-toggle,
    .mobile-nav-close {
        display: inline-flex;
    }
    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 40;
        border: 0;
        padding: 0;
        background: rgba(15, 10, 12, 0.54);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.24s ease;
    }
    body.nav-open .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }
    .theme-toggle {
        order: -1;
    }
    .chat-row {
        max-width: 100%;
    }
    .chat-search-bar {
        flex-wrap: wrap;
    }
    .ticket-pill-group {
        justify-content: flex-start;
    }
    .section-head {
        align-items: flex-start;
        flex-wrap: wrap;
    }
    .section-head .btn {
        width: auto;
    }
    .table-wrap table {
        min-width: 680px;
    }
}

@media (max-width: 768px) {
    .stats,
    .three,
    .two-col,
    .detail,
    .ticket-secondary-grid,
    .stack.two {
        grid-template-columns: 1fr;
    }
    .card {
        padding: 1.1rem;
    }
    .section-head {
        flex-direction: column;
        align-items: stretch;
    }
    .section-head .btn,
    .section-head .btn.secondary,
    .section-head .btn-sm {
        width: 100%;
    }
    .timesheet-filter-bar {
        grid-template-columns: 1fr;
    }
    .timesheet-entry-grid {
        grid-template-columns: 1fr;
    }
    .timesheet-hero-stats {
        grid-template-columns: 1fr;
    }
    .timesheet-hero-total {
        justify-items: start;
        text-align: left;
        min-width: 0;
    }
    .timesheet-breakdown-row {
        grid-template-columns: 1fr;
    }
    .timesheet-breakdown-right {
        justify-items: start;
        text-align: left;
        min-width: 0;
    }
    .timesheet-day-window-head,
    .timesheet-day-window-foot,
    .timesheet-day-window-extra {
        justify-content: flex-start;
    }
    .timesheet-project-head {
        flex-direction: column;
        align-items: flex-start;
    }
    .timesheet-project-meta {
        justify-content: flex-start;
    }
    .timesheet-project-activity {
        grid-template-columns: 1fr;
    }
    .projects-layout,
    .projects-overview-layout,
    .projects-detail-grid {
        grid-template-columns: 1fr;
    }
    .project-hardware-row-fields {
        grid-template-columns: 1fr;
    }
    .projects-detail-stats {
        min-width: 0;
        grid-template-columns: 1fr;
    }
    .projects-detail-top {
        align-items: flex-start;
    }
    .timesheet-modal {
        width: calc(100vw - 1rem);
    }
    .timesheet-modal-card {
        padding: 1rem;
        border-radius: 22px;
    }
    .timesheet-modal-head {
        flex-direction: column;
    }
    .timesheet-topbar {
        align-items: stretch;
    }
    .timesheet-period-nav,
    .timesheet-mode-switch {
        width: 100%;
    }
    .timesheet-mode-switch .btn,
    .timesheet-period-nav .btn {
        flex: 1 1 0;
    }
    .ticket-hero {
        flex-direction: column;
        align-items: stretch;
    }
    .ticket-pill-group {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 15px;
    }
    .main {
        padding: 1rem;
    }
    .sidebar {
        padding: 1rem;
    }
    .card, .auth-card {
        border-radius: 18px;
        padding: 1.15rem;
    }
    .meta-grid {
        grid-template-columns: 1fr;
    }
    .ticket-hero, .chat-meta, .brand {
        flex-direction: column;
        align-items: start;
    }
    .brand {
        position: relative;
        padding-right: 3.4rem;
    }
    .mobile-nav-close {
        position: absolute;
        top: 0;
        right: 0;
    }
    .page-title strong {
        font-size: 1.15rem;
    }
    .ticket-hero h2 {
        font-size: 1.45rem;
    }
    .stats {
        grid-template-columns: 1fr;
    }
    .topbar {
        padding: 0.95rem 1rem;
    }
    .topbar-start {
        align-items: center;
        flex-wrap: nowrap;
    }
    .topbar-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .page-title {
        flex: 1 1 auto;
    }
    .page-title strong,
    h1, h2, h3,
    .muted,
    td,
    th,
    span,
    p,
    a,
    strong,
    label {
        overflow-wrap: anywhere;
    }
    .topbar-actions form,
    .topbar-actions .btn,
    .theme-toggle {
        width: 100%;
    }
    .tabs-nav {
        display: grid;
        grid-template-columns: 1fr;
    }
    .tab-button {
        width: 100%;
    }
    .theme-toggle {
        justify-content: center;
    }
    .btn,
    .btn.secondary,
    .btn-sm {
        width: 100%;
    }
    .btn-block {
        width: 100%;
        justify-self: stretch;
    }
    .nav a {
        padding: 0.9rem 1rem;
    }
    .filter-checkbox {
        width: 100%;
        justify-content: flex-start;
    }
    .filter-actions {
        flex-direction: column;
    }
    .chat-window {
        padding: 1rem;
    }
    .chat-thread {
        min-height: 0;
        max-height: 48vh;
        padding-right: 0.15rem;
    }
    .attachment-item {
        flex-direction: column;
        align-items: stretch;
    }
    .table-wrap table {
        min-width: 0;
    }
    .responsive-table thead {
        display: none;
    }
    .responsive-table,
    .responsive-table tbody,
    .responsive-table tr,
    .responsive-table td {
        display: block;
        width: 100%;
    }
    .responsive-table tr {
        padding: 0.95rem 0;
        border-bottom: 1px solid var(--line);
    }
    .responsive-table td {
        border-bottom: 0;
        padding: 0.4rem 0;
        text-align: left;
        overflow-wrap: anywhere;
    }
    .responsive-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0.22rem;
        color: var(--muted);
        font-size: 0.78rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
    }
    .responsive-table td[data-label="Actie"] .btn {
        width: 100%;
    }
    input, textarea, select, button {
        padding: 0.95rem 1rem;
    }
    .btn, .btn.secondary, .btn-sm {
        min-height: 44px;
        font-size: 0.95rem;
    }
    .stat strong {
        font-size: 2.15rem;
    }
}

.offers-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}
.offers-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.offer-items-block {
    display: grid;
    gap: 0.6rem;
}
.offer-compose-form {
    display: grid;
    gap: 1rem;
}
.offers-compose-wide {
    display: grid;
    gap: 1rem;
    width: 100%;
}
.offers-compose-wide > .card {
    width: 100%;
}
.wysiwyg-shell {
    display: grid;
    gap: 0.5rem;
}
.tox-tinymce {
    border-radius: 18px !important;
    border-color: var(--line) !important;
    overflow: hidden;
    box-shadow: none !important;
    min-height: 680px !important;
}
.tox .tox-editor-header,
.tox .tox-toolbar,
.tox .tox-toolbar__primary,
.tox .tox-menubar,
.tox .tox-statusbar {
    background: var(--panel-strong) !important;
    border-color: var(--line) !important;
    color: var(--ink) !important;
}
.tox .tox-edit-area__iframe {
    background: var(--panel-strong) !important;
}
.tox .tox-toolbar__group {
    border-color: var(--line) !important;
}
.tox .tox-tbtn {
    color: var(--ink) !important;
}
.tox .tox-tbtn svg {
    fill: var(--ink) !important;
}
.tox .tox-tbtn:not(.tox-tbtn--bespoke):hover,
.tox .tox-tbtn:not(.tox-tbtn--bespoke):focus,
.tox .tox-tbtn--enabled:not(.tox-tbtn--bespoke) {
    background: rgba(214, 40, 57, 0.12) !important;
    color: var(--accent-strong) !important;
}
.tox .tox-tbtn:not(.tox-tbtn--bespoke):hover svg,
.tox .tox-tbtn:not(.tox-tbtn--bespoke):focus svg,
.tox .tox-tbtn--enabled:not(.tox-tbtn--bespoke) svg {
    fill: var(--accent-strong) !important;
}
.tox .tox-split-button:hover,
.tox .tox-split-button:focus,
.tox .tox-collection__item--active {
    background: rgba(214, 40, 57, 0.12) !important;
}
.tox .tox-edit-area__iframe hr.page-break {
    border: 0;
    border-top: 2px dashed var(--line);
    margin: 1.25rem 0;
    break-after: page;
    page-break-after: always;
}
.tox .tox-statusbar__path {
    color: var(--muted) !important;
}
.tox .tox-statusbar__wordcount {
    color: var(--muted) !important;
}
.offer-items-editor {
    display: grid;
    gap: 1rem;
    margin-bottom: 10px;
}
.offer-items-head {
    display: grid;
    grid-template-columns: 34px 88px 128px minmax(260px, 2.2fr) minmax(84px, 0.75fr) minmax(110px, 0.95fr) minmax(120px, 1fr) minmax(80px, 0.7fr) minmax(110px, 0.9fr) 44px;
    gap: 0.75rem;
    align-items: center;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.offer-items-rows {
    display: grid;
    gap: 0.65rem;
}
.offer-item-row {
    display: grid;
    grid-template-columns: 34px 88px 128px minmax(260px, 2.2fr) minmax(84px, 0.75fr) minmax(110px, 0.95fr) minmax(120px, 1fr) minmax(80px, 0.7fr) minmax(110px, 0.9fr) 44px;
    gap: 0.75rem;
    align-items: center;
}
.offer-item-index {
    text-align: center;
    color: var(--muted);
    font-size: 0.92rem;
}
.offer-item-row.is-text-row {
    grid-template-columns: 34px 88px 108px minmax(260px, 1fr) 44px;
}
.offer-item-row.is-text-row [data-period-wrap],
.offer-item-row.is-text-row input[name*="[quantity]"],
.offer-item-row.is-text-row input[name*="[unit_price]"],
.offer-item-row.is-text-row input[name*="[internal_cost]"],
.offer-item-row.is-text-row input[name*="[vat_rate]"],
.offer-item-row.is-text-row [data-line-total] {
    display: none;
}
.offer-item-select {
    min-width: 0;
}
.offer-item-select select {
    min-width: 0;
    width: 100%;
}
.offer-item-row input[type="text"],
.offer-item-row input[type="number"] {
    min-width: 0;
    width: 100%;
}
.offer-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.25rem;
}
.icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--danger);
    font-size: 1.2rem;
    line-height: 1;
}
.offer-summary-card {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.8rem;
    padding: 0.9rem;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--panel);
}
.offer-summary-card div {
    display: grid;
    gap: 0.25rem;
}
.offer-summary-card span {
    font-size: 0.82rem;
    color: var(--muted);
}
.offer-summary-card strong {
    word-break: break-word;
}
.offer-compose-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.7rem;
    align-items: center;
}
.offer-public-terms {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}
.offer-public-text-row td {
    background: rgba(214, 40, 57, 0.04);
    font-style: italic;
}
.offer-items-grid {
    display: grid;
    grid-template-columns: minmax(70px, 0.8fr) 2.2fr repeat(3, minmax(90px, 1fr));
    gap: 0.5rem;
}
.offer-items-grid.is-compact {
    grid-template-columns: 2.2fr repeat(3, minmax(90px, 1fr));
}
.offer-actions {
    margin-top: 1rem;
    display: grid;
    gap: 0.5rem;
}
.offer-link-card {
    margin-top: 1rem;
    padding: 0.85rem;
    border-radius: 12px;
    border: 1px dashed var(--line);
    background: var(--panel);
    display: grid;
    gap: 0.35rem;
}
.offer-summary-grid,
.offer-status-timeline {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}
.offer-summary-grid div,
.offer-status-timeline div {
    display: grid;
    gap: 0.25rem;
}
.offers-detail-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    gap: 0.8rem;
}
.offers-detail-top-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.offer-template-card {
    padding: 0.9rem;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--panel-strong);
}
.offer-template-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}
.offer-events-list {
    display: grid;
    gap: 0.6rem;
}
.offer-event {
    padding: 0.7rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--panel);
    display: grid;
    gap: 0.2rem;
}
.public-body {
    font-family: "Manrope", sans-serif;
}
.public-shell {
 max-width: 1300px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}
.public-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.4rem;
}
.public-kicker {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.75rem;
    color: var(--muted);
}
.offer-public-card {
    padding: 1.6rem;
}
.offer-public-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}
.offer-public-meta {
    display: grid;
    gap: 0.4rem;
    justify-items: end;
}
.offer-public-body {
    padding: 0.9rem 0;
}
.offer-public-terms {
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px dashed var(--line);
    color: var(--muted);
}
.offer-public-items {
    margin-top: 0.8rem;
}
.offer-public-actions {
    display: grid;
    gap: 0.6rem;
    margin-top: 1rem;
}
.offer-approve-dialog {
    border: 0;
    padding: 0;
    background: transparent;
    width: min(760px, calc(100vw - 32px));
}
.offer-approve-dialog::backdrop {
    background: rgba(15, 23, 42, 0.45);
}
.offer-approve-dialog-card {
    background: #ffffff;
    border-radius: 22px;
    border: 1px solid var(--line);
    padding: 1.4rem;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
    display: grid;
    gap: 1rem;
}
.offer-approve-dialog-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}
.offer-approve-form {
    display: grid;
    gap: 1rem;
}
.offer-verify-form input,
.offer-verify-form textarea,
.offer-verify-form select,
.offer-approve-form input,
.offer-approve-form textarea,
.offer-approve-form select {
    background: #ffffff;
    color: #191516;
    border-color: rgba(116, 78, 86, 0.18);
}
.offer-verify-form input::placeholder,
.offer-approve-form input::placeholder,
.offer-approve-form textarea::placeholder {
    color: #8a7b80;
}
.offer-approve-form label {
    display: grid;
    gap: 0.35rem;
    font-weight: 600;
}
.offer-signature-field {
    display: grid;
    gap: 0.6rem;
}
.offer-signature-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}
.offer-signature-canvas {
    width: 100%;
    height: 220px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #ffffff;
    touch-action: none;
}
.offer-approve-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}
.offer-public-pdf-card {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}
.offer-public-pdf-head {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}
.offer-public-pdf-frame {
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    background: #cbd5e1;
    min-height: 70vh;
}
.offer-public-pdf-frame iframe {
    display: block;
    width: 100%;
    height: 70vh;
    border: 0;
    background: #ffffff;
}
.offer-public-actions form {
    display: grid;
    gap: 0.4rem;
}
.offer-verify-form {
    margin-top: 1rem;
}

@media (max-width: 900px) {
    .offer-items-head,
    .offer-item-row {
        grid-template-columns: 24px 1fr;
    }
    .offer-items-head {
        display: none;
    }
    .offer-item-row,
    .offer-item-row.is-text-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
    .offer-item-row > * {
        grid-column: auto !important;
    }
    .offer-summary-card {
        grid-template-columns: 1fr;
    }
    .offer-items-grid {
        grid-template-columns: 1fr;
    }
    .offer-public-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .offer-public-meta {
        justify-items: start;
    }
    .offer-public-pdf-frame {
        display: none;
    }
    .offer-approve-dialog {
        width: calc(100vw - 20px);
    }
    .offer-approve-dialog-head,
    .offer-signature-head,
    .offer-approve-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .offer-summary-grid,
    .offer-status-timeline {
        grid-template-columns: 1fr;
    }
}
