:root {
    --teal-950: #033947;
    --teal-900: #074d60;
    --teal-800: #0b6075;
    --teal-700: #0f748a;
    --teal-100: #dff0f4;
    --teal-50: #f0f8fa;
    --gold: #f6b210;
    --green: #69a93f;
    --magenta: #8f246d;
    --blue: #0583ae;
    --ink: #182b34;
    --muted: #61747d;
    --muted-2: #8ba0a9;
    --border: #dbe5e9;
    --border-strong: #c8d6dc;
    --surface: #ffffff;
    --canvas: #f2f6f8;
    --danger: #c83e4d;
    --danger-soft: #fff0f1;
    --warning: #b97900;
    --warning-soft: #fff7df;
    --success: #2a824f;
    --success-soft: #e9f7ef;
    --info: #2a6e96;
    --info-soft: #eaf4fa;
    --shadow-sm: 0 3px 14px rgba(21, 50, 62, .06);
    --shadow-md: 0 18px 55px rgba(12, 47, 61, .14);
    --shadow-lg: 0 28px 90px rgba(5, 41, 55, .22);
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--canvas);
    font-synthesis: none;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 82% 0%, rgba(15, 116, 138, .07), transparent 30rem),
        var(--canvas);
    color: var(--ink);
}

body.modal-open {
    overflow: hidden;
}

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

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    color: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

.hidden {
    display: none !important;
}

.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;
}

.eyebrow,
.step-kicker {
    display: inline-block;
    color: var(--teal-700);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}

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

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 28px 20px 22px;
    background:
        linear-gradient(150deg, rgba(255,255,255,.04), transparent 45%),
        var(--teal-950);
    color: #fff;
    overflow: hidden;
}

.sidebar::after {
    position: absolute;
    right: -72px;
    bottom: 40px;
    width: 180px;
    height: 180px;
    border: 34px solid rgba(255, 255, 255, .025);
    border-radius: 50%;
    content: "";
}

.brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 30px;
}

.brand img {
    width: 45px;
    height: 45px;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
    padding: 4px;
}

.brand strong,
.brand span {
    display: block;
}

.brand strong {
    font-size: .95rem;
    letter-spacing: .01em;
}

.brand span {
    margin-top: 2px;
    color: rgba(255, 255, 255, .62);
    font-size: .75rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.side-nav {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 7px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 13px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: rgba(255, 255, 255, .68);
    font-size: .87rem;
    font-weight: 650;
    text-align: left;
    cursor: pointer;
    transition: .18s ease;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.nav-item.active {
    box-shadow: inset 3px 0 0 var(--gold);
}

.nav-icon {
    display: grid;
    place-items: center;
    width: 25px;
    height: 25px;
    font-size: 1.15rem;
}

.sidebar-note {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: auto;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 13px;
    background: rgba(255, 255, 255, .055);
}

.sidebar-note strong,
.sidebar-note small {
    display: block;
}

.sidebar-note strong {
    font-size: .76rem;
}

.sidebar-note small {
    margin-top: 3px;
    color: rgba(255, 255, 255, .55);
    font-size: .66rem;
    line-height: 1.4;
}

.status-dot {
    width: 8px;
    height: 8px;
    margin-top: 4px;
    border-radius: 50%;
    background: #69cf91;
    box-shadow: 0 0 0 4px rgba(105, 207, 145, .12);
}

.main-content {
    width: 100%;
    max-width: 1550px;
    min-width: 0;
    margin: 0 auto;
    padding: 34px 38px 60px;
}

.topbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 27px;
}

.topbar h1 {
    margin: 4px 0 4px;
    font-size: clamp(1.7rem, 2.4vw, 2.35rem);
    letter-spacing: -.045em;
}

.topbar p {
    margin: 0;
    color: var(--muted);
    font-size: .9rem;
}

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

.mobile-settings {
    display: none !important;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 11px;
    font-size: .84rem;
    font-weight: 750;
    line-height: 1;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: .58;
}

.btn-primary {
    background: linear-gradient(135deg, var(--teal-800), var(--teal-900));
    color: #fff;
    box-shadow: 0 8px 20px rgba(7, 77, 96, .18);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 12px 24px rgba(7, 77, 96, .25);
}

.btn-secondary {
    border-color: #bcd5dd;
    background: var(--teal-50);
    color: var(--teal-900);
}

.btn-light {
    border-color: var(--border);
    background: #fff;
    color: var(--ink);
}

.btn-danger {
    border-color: #f0c7cc;
    background: var(--danger-soft);
    color: var(--danger);
}

.btn-block {
    width: 100%;
}

.icon-only {
    width: 42px;
    padding: 0;
}

.dashboard {
    display: grid;
    grid-template-columns: minmax(250px, 1.45fr) repeat(3, minmax(165px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.metric-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 115px;
    padding: 19px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .9);
    box-shadow: var(--shadow-sm);
}

.metric-card.metric-primary {
    border: 0;
    background:
        radial-gradient(circle at 90% 20%, rgba(255,255,255,.13), transparent 8rem),
        linear-gradient(135deg, var(--teal-800), var(--teal-950));
    color: #fff;
}

.metric-icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: rgba(255,255,255,.14);
    color: #fff;
    font-size: 1.25rem;
    font-weight: 800;
}

.metric-card:not(.metric-primary) .metric-icon {
    background: var(--teal-100);
    color: var(--teal-800);
}

.metric-card:not(.metric-primary) .metric-sent {
    background: var(--info-soft);
    color: var(--info);
}

.metric-card:not(.metric-primary) .metric-approved {
    background: var(--success-soft);
    color: var(--success);
}

.metric-card span,
.metric-card strong,
.metric-card small {
    display: block;
}

.metric-card span {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: .73rem;
    font-weight: 700;
}

.metric-card.metric-primary span,
.metric-card.metric-primary small {
    color: rgba(255,255,255,.64);
}

.metric-card strong {
    font-size: 1.5rem;
    letter-spacing: -.03em;
}

.metric-card small {
    margin-top: 3px;
    color: var(--muted-2);
    font-size: .66rem;
}

.proposal-panel {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, .96);
    box-shadow: var(--shadow-sm);
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 23px 24px 18px;
    border-bottom: 1px solid #edf2f4;
}

.panel-heading h2 {
    margin: 0 0 4px;
    font-size: 1.05rem;
}

.panel-heading p {
    margin: 0;
    color: var(--muted);
    font-size: .74rem;
}

.panel-tools {
    display: flex;
    gap: 8px;
    align-items: center;
}

.panel-tools select,
.search-box {
    height: 39px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

.panel-tools select {
    min-width: 145px;
    padding: 0 32px 0 11px;
    color: var(--ink);
    font-size: .76rem;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 7px;
    width: min(300px, 26vw);
    padding: 0 11px;
}

.search-box span {
    color: var(--muted-2);
    font-size: 1.2rem;
}

.search-box input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
    font-size: .78rem;
}

.table-wrap {
    overflow-x: auto;
}

.proposal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .78rem;
}

.proposal-table th {
    padding: 12px 16px;
    background: #fafcfd;
    color: var(--muted);
    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-align: left;
    text-transform: uppercase;
}

.proposal-table td {
    padding: 15px 16px;
    border-top: 1px solid #edf2f4;
    vertical-align: middle;
}

.proposal-table tbody tr {
    transition: background .15s ease;
}

.proposal-table tbody tr:hover:not(.loading-row) {
    background: #fbfdfd;
}

.proposal-code {
    display: block;
    color: var(--teal-800);
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .01em;
}

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

.proposal-date,
.table-secondary {
    display: block;
    margin-top: 3px;
    color: var(--muted-2);
    font-size: .66rem;
}

.event-cell strong {
    display: block;
    max-width: 300px;
    overflow: hidden;
    color: var(--ink);
    font-size: .8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.model-badge,
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 25px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: .65rem;
    font-weight: 750;
}

.model-badge {
    background: var(--teal-50);
    color: var(--teal-800);
}

.model-badge.rsvp {
    background: var(--info-soft);
    color: var(--info);
}

.model-badge.custom {
    background: #f8edf5;
    color: var(--magenta);
}

.status-badge::before {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

.status-draft {
    background: #f0f3f5;
    color: #6a7c84;
}

.status-sent {
    background: var(--info-soft);
    color: var(--info);
}

.status-approved {
    background: var(--success-soft);
    color: var(--success);
}

.status-expired {
    background: var(--warning-soft);
    color: var(--warning);
}

.status-cancelled {
    background: var(--danger-soft);
    color: var(--danger);
}

.table-value {
    white-space: nowrap;
    font-weight: 800;
}

.row-actions {
    position: relative;
    display: flex;
    justify-content: flex-end;
    gap: 5px;
}

.row-action {
    display: grid;
    place-items: center;
    width: 31px;
    height: 31px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
}

.row-action:hover {
    border-color: #aac8d1;
    color: var(--teal-800);
}

.row-action.danger:hover {
    border-color: #e9b8bf;
    background: var(--danger-soft);
    color: var(--danger);
}

.loading-row td {
    padding: 60px !important;
    color: var(--muted);
    text-align: center;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 7px;
    border: 2px solid #cbd9de;
    border-top-color: var(--teal-700);
    border-radius: 50%;
    vertical-align: -3px;
    animation: spin .75s linear infinite;
}

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

.empty-state {
    padding: 65px 24px 72px;
    text-align: center;
}

.empty-illustration {
    display: grid;
    place-items: center;
    width: 74px;
    height: 74px;
    margin: 0 auto 18px;
    border: 1px dashed #aacbd4;
    border-radius: 22px;
    background: var(--teal-50);
    color: var(--teal-800);
    font-size: .9rem;
    font-weight: 900;
    letter-spacing: .12em;
}

.empty-state h3 {
    margin: 0 0 6px;
}

.empty-state p {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: .82rem;
}

.modal-backdrop {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(3, 35, 45, .68);
    backdrop-filter: blur(8px);
    animation: fadeIn .16s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
}

.modal-card {
    position: relative;
    width: min(920px, 100%);
    max-height: calc(100vh - 44px);
    overflow: auto;
    border-radius: 22px;
    background: #fff;
    box-shadow: var(--shadow-lg);
    animation: modalIn .2s ease;
}

@keyframes modalIn {
    from { transform: translateY(12px) scale(.985); opacity: .3; }
}

.template-modal-card {
    padding: 38px;
}

.modal-card h2 {
    margin: 5px 0 6px;
    font-size: 1.45rem;
    letter-spacing: -.035em;
}

.modal-card > p,
.settings-header p {
    margin: 0;
    color: var(--muted);
    font-size: .82rem;
}

.modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    display: grid;
    place-items: center;
    width: 35px;
    height: 35px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--muted);
    font-size: 1.3rem;
    cursor: pointer;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 13px;
    margin-top: 28px;
}

.template-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-height: 230px;
    padding: 21px;
    border: 1px solid var(--border);
    border-radius: 17px;
    background: #fff;
    text-align: left;
    cursor: pointer;
    transition: .18s ease;
}

.template-option:hover {
    transform: translateY(-3px);
    border-color: #9ec3cd;
    box-shadow: 0 14px 34px rgba(16, 69, 84, .12);
}

.template-symbol {
    display: grid;
    place-items: center;
    width: 45px;
    height: 45px;
    margin-bottom: 18px;
    border-radius: 13px;
    background: var(--teal-100);
    color: var(--teal-800);
    font-size: 1.35rem;
}

.template-rsvp {
    background: var(--info-soft);
    color: var(--info);
}

.template-custom {
    background: #f8edf5;
    color: var(--magenta);
}

.template-option strong {
    font-size: .98rem;
}

.template-option small {
    margin-top: 8px;
    color: var(--muted);
    font-size: .76rem;
    line-height: 1.5;
}

.template-option em {
    margin-top: auto;
    padding-top: 18px;
    color: var(--muted-2);
    font-size: .66rem;
    font-style: normal;
}

.editor-backdrop {
    display: block;
    padding: 0;
    background: var(--canvas);
    backdrop-filter: none;
}

.editor-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: var(--canvas);
}

.editor-header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 84px;
    padding: 13px 30px;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(10px);
}

.editor-heading,
.editor-actions {
    display: flex;
    align-items: center;
    gap: 11px;
}

.back-button {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-right: 4px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fff;
    color: var(--teal-900);
    font-size: 1.15rem;
    cursor: pointer;
}

.editor-heading h2 {
    margin: 2px 0 1px;
    font-size: 1.15rem;
    letter-spacing: -.025em;
}

.editor-heading small {
    color: var(--muted);
    font-size: .67rem;
}

.editor-tabs {
    display: flex;
    flex: 0 0 auto;
    justify-content: center;
    gap: 3px;
    padding: 10px 24px;
    border-bottom: 1px solid var(--border);
    background: #fff;
}

.editor-tab {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font-size: .75rem;
    font-weight: 750;
    cursor: pointer;
}

.editor-tab span {
    display: grid;
    place-items: center;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: #e9eff2;
    color: var(--muted);
    font-size: .62rem;
}

.editor-tab.active {
    background: var(--teal-50);
    color: var(--teal-900);
}

.editor-tab.active span {
    background: var(--teal-800);
    color: #fff;
}

.editor-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 28px max(28px, calc((100vw - 1050px) / 2)) 70px;
}

.editor-pane {
    display: none;
    animation: paneIn .18s ease;
}

.editor-pane.active {
    display: block;
}

@keyframes paneIn {
    from { transform: translateY(4px); opacity: .25; }
}

.form-section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 16px;
}

.form-section-heading h3,
.preview-toolbar h3 {
    margin: 3px 0 4px;
    font-size: 1.3rem;
    letter-spacing: -.035em;
}

.form-section-heading p,
.preview-toolbar p,
.custom-toolbar p,
.settings-list-heading p {
    margin: 0;
    color: var(--muted);
    font-size: .76rem;
}

.compact-field {
    width: 190px;
    margin: 0 !important;
}

.editor-card {
    margin-bottom: 14px;
    padding: 21px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.editor-card h4,
.custom-toolbar h4 {
    margin: 0 0 16px;
    font-size: .9rem;
}

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

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

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

.span-two {
    grid-column: 1 / -1;
}

.field {
    display: block;
    min-width: 0;
}

.field + .field:not(.form-grid .field) {
    margin-top: 14px;
}

.field > span {
    display: block;
    margin-bottom: 6px;
    color: #40545d;
    font-size: .7rem;
    font-weight: 750;
}

.field small,
.form-help {
    display: block;
    margin-top: 5px;
    color: var(--muted-2);
    font-size: .64rem;
    line-height: 1.45;
}

.field input,
.field select,
.field textarea,
.inline-field input,
.money-inline input,
.editable-row input,
.editable-row select {
    width: 100%;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    outline: 0;
    background: #fff;
    color: var(--ink);
    font-size: .8rem;
    transition: border .15s ease, box-shadow .15s ease;
}

.field input,
.field select,
.editable-row input,
.editable-row select {
    height: 41px;
    padding: 0 11px;
}

.field textarea {
    min-height: 96px;
    padding: 10px 11px;
    line-height: 1.5;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.inline-field input:focus,
.money-inline input:focus,
.editable-row input:focus,
.editable-row select:focus {
    border-color: #65a2b2;
    box-shadow: 0 0 0 3px rgba(15, 116, 138, .1);
}

.field input:disabled,
.field select:disabled {
    background: #f2f5f6;
    color: var(--muted-2);
}

.pane-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

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

.service-toggle-card {
    min-height: 130px;
    padding: 17px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.service-toggle-heading {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 11px;
    align-items: start;
}

.service-toggle-heading.no-switch {
    grid-template-columns: 38px minmax(0, 1fr) 150px;
}

.service-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: var(--teal-50);
    color: var(--teal-800);
    font-size: 1.1rem;
}

.service-toggle-heading strong,
.service-toggle-heading small {
    display: block;
}

.service-toggle-heading strong {
    margin-top: 2px;
    font-size: .8rem;
}

.service-toggle-heading small {
    margin-top: 4px;
    color: var(--muted);
    font-size: .65rem;
    line-height: 1.4;
}

.switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    margin-top: 4px;
}

.switch input {
    position: absolute;
    opacity: 0;
}

.switch span {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #cbd7dc;
    cursor: pointer;
    transition: .18s ease;
}

.switch span::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
    content: "";
    transition: .18s ease;
}

.switch input:checked + span {
    background: var(--teal-700);
}

.switch input:checked + span::after {
    transform: translateX(18px);
}

.inline-field {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 17px;
    color: var(--muted);
    font-size: .67rem;
    font-weight: 700;
}

.inline-field input {
    width: 94px;
    height: 35px;
    padding: 0 9px;
}

.simple-card {
    min-height: 95px;
}

.money-inline {
    display: flex;
    align-items: center;
    height: 38px;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
}

.money-inline span {
    padding-left: 9px;
    color: var(--muted);
    font-size: .7rem;
    font-weight: 800;
}

.money-inline input {
    height: 36px;
    border: 0;
    padding: 0 8px;
}

.custom-toolbar,
.settings-list-heading,
.preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 16px;
}

.custom-toolbar h4,
.settings-list-heading h3 {
    margin: 0 0 3px;
}

.custom-items {
    display: grid;
    gap: 10px;
}

.custom-item {
    display: grid;
    grid-template-columns: 130px minmax(180px, 1.3fr) minmax(200px, 1.5fr) 80px 115px 36px;
    gap: 8px;
    align-items: end;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.custom-item .field > span {
    font-size: .61rem;
}

.custom-item-remove,
.editable-remove {
    display: grid;
    place-items: center;
    width: 35px;
    height: 39px;
    border: 1px solid #f0cbd0;
    border-radius: 9px;
    background: var(--danger-soft);
    color: var(--danger);
    cursor: pointer;
}

.custom-item.included .custom-price-field,
.custom-item.included .custom-quantity-field {
    opacity: .35;
    pointer-events: none;
}

.values-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 15px;
    align-items: start;
}

.calculation-card {
    position: sticky;
    top: 0;
    padding: 22px;
    border: 0;
    border-radius: var(--radius);
    background:
        radial-gradient(circle at 90% 0%, rgba(255,255,255,.13), transparent 12rem),
        linear-gradient(150deg, var(--teal-800), var(--teal-950));
    color: #fff;
    box-shadow: 0 18px 40px rgba(7, 77, 96, .2);
}

.calculation-card .eyebrow {
    color: rgba(255,255,255,.58);
}

.calculation-code {
    margin: 5px 0 19px;
    color: #fff;
    font-size: .8rem;
    font-weight: 800;
}

.calculation-lines {
    display: grid;
    gap: 9px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,.13);
}

.calculation-item,
.calculation-summary > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: .71rem;
}

.calculation-item span {
    color: rgba(255,255,255,.68);
}

.calculation-item strong {
    white-space: nowrap;
    font-size: .72rem;
}

.calculation-summary {
    display: grid;
    gap: 10px;
    padding-top: 16px;
}

.calculation-summary span {
    color: rgba(255,255,255,.68);
}

.discount-line strong {
    color: #b9ecc9;
}

.calculation-summary .total-line {
    align-items: flex-end;
    margin-top: 4px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,.13);
}

.total-line strong {
    font-size: 1.25rem;
    letter-spacing: -.03em;
}

.bonus-hint {
    margin-top: 18px;
    padding: 11px;
    border-radius: 10px;
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.7);
    font-size: .66rem;
    line-height: 1.45;
}

.preview-pane {
    max-width: 1080px;
    margin: 0 auto;
}

.preview-stage {
    min-height: 600px;
    overflow: auto;
    padding: 30px;
    border-radius: var(--radius);
    background: #dfe7ea;
}

.pdf-preview {
    width: min(794px, 100%);
    min-height: 1123px;
    margin: 0 auto;
    padding: 45px 48px 55px;
    background: #fff;
    color: #1d3038;
    box-shadow: 0 18px 45px rgba(30, 55, 65, .18);
    font-family: Arial, Helvetica, sans-serif;
}

.preview-header {
    display: grid;
    grid-template-columns: 120px 1fr 180px;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 5px solid var(--teal-900);
}

.preview-header img {
    width: 75px;
}

.preview-title {
    color: var(--teal-950);
    font-size: .95rem;
    font-weight: 900;
    line-height: 1.05;
    text-align: center;
}

.preview-contact {
    color: var(--muted);
    font-size: .55rem;
    line-height: 1.6;
    text-align: right;
}

.preview-contact strong {
    display: block;
    color: var(--teal-900);
}

.preview-section-title {
    margin-top: 15px;
    padding: 6px 10px;
    border-left: 5px solid var(--gold);
    background: var(--teal-900);
    color: #fff;
    font-size: .58rem;
    font-weight: 900;
    letter-spacing: .05em;
}

.preview-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-left: 1px solid var(--border-strong);
}

.preview-summary > div {
    min-height: 44px;
    padding: 7px;
    border-right: 1px solid var(--border-strong);
    border-bottom: 1px solid var(--border-strong);
}

.preview-summary span,
.preview-summary strong {
    display: block;
}

.preview-summary span {
    color: var(--muted);
    font-size: .46rem;
    font-weight: 800;
    text-transform: uppercase;
}

.preview-summary strong {
    margin-top: 5px;
    font-size: .58rem;
}

.preview-features {
    margin: 9px 0 0;
    padding: 0 0 0 17px;
    color: #2d424b;
    font-size: .55rem;
    line-height: 1.55;
}

.preview-pricing {
    width: 100%;
    margin-top: 0;
    border-collapse: collapse;
    font-size: .54rem;
}

.preview-pricing th,
.preview-pricing td {
    padding: 7px;
    border: 1px solid var(--border-strong);
    text-align: left;
}

.preview-pricing th {
    background: var(--teal-50);
    color: var(--teal-950);
    font-size: .48rem;
    text-transform: uppercase;
}

.preview-pricing th:nth-child(2),
.preview-pricing td:nth-child(2) {
    width: 55px;
    text-align: center;
}

.preview-pricing th:last-child,
.preview-pricing td:last-child {
    width: 90px;
    text-align: right;
}

.preview-pricing td small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    line-height: 1.4;
}

.preview-total-box {
    width: 250px;
    margin: 12px 0 0 auto;
    font-size: .57rem;
}

.preview-total-box > div {
    display: flex;
    justify-content: space-between;
    padding: 6px 9px;
    border: 1px solid var(--border);
    border-bottom: 0;
}

.preview-total-box .preview-grand-total {
    border: 0;
    background: var(--teal-950);
    color: #fff;
    font-size: .68rem;
    font-weight: 900;
}

.preview-text-block {
    margin-top: 7px;
    color: #344951;
    font-size: .52rem;
    line-height: 1.55;
    white-space: pre-line;
}

.preview-payment {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
    padding: 9px;
    border: 1px solid var(--border);
    background: #f8fbfc;
    font-size: .52rem;
    line-height: 1.55;
}

.preview-signature {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 25px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: .52rem;
    line-height: 1.55;
}

.preview-signature strong {
    display: block;
    color: var(--teal-950);
    font-size: .62rem;
}

.preview-signature img {
    width: 48px;
    height: 48px;
}

.settings-card {
    width: min(1050px, 100%);
    overflow: hidden;
}

.settings-header {
    position: relative;
    padding: 27px 30px 20px;
}

.static-close {
    top: 25px;
    right: 28px;
}

.settings-tabs {
    display: flex;
    gap: 3px;
    padding: 0 30px 12px;
    border-bottom: 1px solid var(--border);
}

.settings-tabs button,
.table-selector button {
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 750;
    cursor: pointer;
}

.settings-tabs button.active,
.table-selector button.active {
    background: var(--teal-50);
    color: var(--teal-900);
}

.settings-pane {
    display: none;
    max-height: calc(100vh - 260px);
    overflow: auto;
    padding: 23px 30px 30px;
}

.settings-pane.active {
    display: block;
}

.settings-list-heading {
    margin-bottom: 15px;
}

.table-selector {
    display: inline-flex;
    gap: 3px;
    margin-bottom: 12px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

.editable-table {
    display: grid;
    gap: 8px;
}

.editable-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 110px 38px;
    gap: 8px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fff;
}

.editable-table.wide .editable-row {
    grid-template-columns: repeat(6, minmax(90px, 1fr));
}

.editable-row .field > span {
    font-size: .58rem;
}

.settings-footer {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    padding: 15px 30px;
    border-top: 1px solid var(--border);
    background: #fafcfd;
}

.toast-stack {
    position: fixed;
    z-index: 300;
    right: 22px;
    bottom: 22px;
    display: grid;
    gap: 9px;
    width: min(370px, calc(100vw - 44px));
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 15px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--teal-700);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow-md);
    animation: toastIn .22s ease;
}

@keyframes toastIn {
    from { transform: translateX(18px); opacity: 0; }
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

.toast strong,
.toast span {
    display: block;
}

.toast strong {
    font-size: .76rem;
}

.toast span {
    margin-top: 3px;
    color: var(--muted);
    font-size: .7rem;
    line-height: 1.4;
}

.install-page {
    display: grid;
    place-items: center;
    padding: 28px;
    background:
        radial-gradient(circle at 20% 10%, rgba(15,116,138,.18), transparent 30rem),
        var(--teal-950);
}

.install-shell {
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    width: min(1020px, 100%);
    overflow: hidden;
    border-radius: 26px;
    background: #fff;
    box-shadow: 0 35px 100px rgba(0,0,0,.3);
}

.install-brand {
    position: relative;
    padding: 48px;
    overflow: hidden;
    background:
        radial-gradient(circle at 100% 100%, rgba(255,255,255,.11), transparent 20rem),
        linear-gradient(150deg, var(--teal-800), var(--teal-950));
    color: #fff;
}

.install-brand::after {
    position: absolute;
    right: -90px;
    bottom: -90px;
    width: 260px;
    height: 260px;
    border: 45px solid rgba(255,255,255,.035);
    border-radius: 50%;
    content: "";
}

.install-brand img {
    width: 72px;
    height: 72px;
    margin-bottom: 36px;
    border-radius: 18px;
    background: #fff;
    padding: 7px;
}

.install-brand .eyebrow {
    color: #93d0de;
}

.install-brand h1 {
    max-width: 430px;
    margin: 8px 0 14px;
    font-size: clamp(2rem, 3.6vw, 3rem);
    line-height: 1.05;
    letter-spacing: -.05em;
}

.install-brand > p {
    max-width: 460px;
    color: rgba(255,255,255,.7);
    font-size: .84rem;
    line-height: 1.65;
}

.install-features {
    display: grid;
    gap: 10px;
    margin: 28px 0 0;
    padding: 0;
    list-style: none;
    color: rgba(255,255,255,.82);
    font-size: .76rem;
}

.install-features li::before {
    margin-right: 8px;
    color: #82d3a0;
    content: "✓";
    font-weight: 900;
}

.install-card {
    padding: 48px;
}

.install-card h2 {
    margin: 6px 0 22px;
    font-size: 1.45rem;
    letter-spacing: -.035em;
}

.install-form .field {
    margin-bottom: 14px;
}

.install-form .form-grid .field {
    margin-bottom: 0;
}

.install-form .form-grid {
    margin-bottom: 14px;
}

.alert {
    margin-bottom: 17px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: .72rem;
    line-height: 1.45;
}

.alert-danger {
    border: 1px solid #efc4ca;
    background: var(--danger-soft);
    color: #9b2635;
}

.success-state {
    padding: 35px 0;
    text-align: center;
}

.success-icon {
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    margin: 0 auto 22px;
    border-radius: 50%;
    background: var(--success-soft);
    color: var(--success);
    font-size: 2rem;
    font-weight: 900;
}

.success-state p {
    margin: 0 0 22px;
    color: var(--muted);
    font-size: .82rem;
}

code {
    padding: 2px 5px;
    border-radius: 5px;
    background: #edf3f5;
    color: var(--teal-900);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .85em;
}

@media (max-width: 1180px) {
    .dashboard {
        grid-template-columns: repeat(2, 1fr);
    }

    .panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .panel-tools {
        width: 100%;
    }

    .search-box {
        flex: 1;
        width: auto;
    }

    .custom-item {
        grid-template-columns: 120px 1fr 1fr 75px 105px 36px;
    }
}

@media (max-width: 920px) {
    .app-shell {
        grid-template-columns: 74px minmax(0, 1fr);
    }

    .sidebar {
        padding: 22px 12px;
    }

    .brand {
        justify-content: center;
        padding: 0 0 28px;
    }

    .brand div,
    .nav-item span:last-child,
    .sidebar-note div {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 12px;
    }

    .sidebar-note {
        justify-content: center;
        padding: 14px 8px;
    }

    .main-content {
        padding: 28px 24px 50px;
    }

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

    .template-option {
        min-height: 150px;
    }

    .editor-body {
        padding: 24px 28px 60px;
    }

    .values-layout {
        grid-template-columns: 1fr;
    }

    .calculation-card {
        position: static;
    }

    .custom-item {
        grid-template-columns: 120px 1fr 1fr;
    }

    .custom-item-remove {
        grid-column: 3;
        justify-self: end;
    }

    .install-shell {
        grid-template-columns: 1fr;
    }

    .install-brand {
        padding: 38px;
    }

    .install-brand h1 {
        font-size: 2.3rem;
    }
}

@media (max-width: 720px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        display: none;
    }

    .main-content {
        padding: 22px 15px 42px;
    }

    .topbar {
        align-items: center;
        margin-bottom: 20px;
    }

    .topbar p {
        display: none;
    }

    .mobile-settings {
        display: inline-flex !important;
    }

    .dashboard {
        display: flex;
        overflow-x: auto;
        padding-bottom: 4px;
        scroll-snap-type: x mandatory;
    }

    .metric-card {
        flex: 0 0 235px;
        min-height: 105px;
        scroll-snap-align: start;
    }

    .panel-heading {
        padding: 19px 16px 14px;
    }

    .panel-tools {
        flex-wrap: wrap;
    }

    .search-box {
        flex: 1 0 100%;
    }

    .panel-tools select {
        flex: 1;
        min-width: 130px;
    }

    .proposal-table th:nth-child(3),
    .proposal-table td:nth-child(3),
    .proposal-table th:nth-child(4),
    .proposal-table td:nth-child(4) {
        display: none;
    }

    .template-modal-card {
        padding: 30px 20px 22px;
    }

    .modal-backdrop {
        padding: 10px;
    }

    .editor-header {
        min-height: 74px;
        padding: 10px 14px;
    }

    .editor-heading .eyebrow,
    .editor-heading small,
    #editorPreviewButton {
        display: none;
    }

    .editor-heading h2 {
        max-width: 160px;
        overflow: hidden;
        font-size: .95rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .editor-actions {
        gap: 6px;
    }

    .editor-actions .btn {
        min-height: 38px;
        padding: 8px 10px;
        font-size: .7rem;
    }

    .editor-tabs {
        justify-content: flex-start;
        overflow-x: auto;
        padding: 8px 12px;
    }

    .editor-tab {
        flex: 0 0 auto;
        padding: 7px 9px;
        font-size: .67rem;
    }

    .editor-body {
        padding: 20px 15px 55px;
    }

    .form-section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .compact-field {
        width: 100%;
    }

    .form-grid.two,
    .form-grid.two-wide,
    .form-grid.three,
    .standard-services {
        grid-template-columns: 1fr;
    }

    .custom-item {
        grid-template-columns: 1fr 1fr;
    }

    .custom-item .field:nth-child(2),
    .custom-item .field:nth-child(3) {
        grid-column: 1 / -1;
    }

    .custom-item-remove {
        grid-column: 2;
    }

    .preview-stage {
        padding: 10px;
    }

    .pdf-preview {
        min-height: 850px;
        padding: 25px 22px 35px;
    }

    .preview-header {
        grid-template-columns: 70px 1fr 100px;
    }

    .preview-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .settings-card {
        max-height: calc(100vh - 20px);
    }

    .settings-header {
        padding: 23px 20px 16px;
    }

    .settings-tabs {
        overflow-x: auto;
        padding: 0 20px 10px;
    }

    .settings-tabs button {
        flex: 0 0 auto;
    }

    .settings-pane {
        padding: 18px 20px 25px;
    }

    .editable-table.wide .editable-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .settings-footer {
        padding: 13px 20px;
    }

    .install-page {
        padding: 12px;
    }

    .install-brand,
    .install-card {
        padding: 28px 24px;
    }

    .install-brand img {
        width: 58px;
        height: 58px;
        margin-bottom: 24px;
    }

    .install-brand h1 {
        font-size: 2rem;
    }
}

@media print {
    .sidebar,
    .topbar,
    .dashboard,
    .proposal-panel,
    .editor-header,
    .editor-tabs,
    .preview-toolbar,
    .pane-navigation {
        display: none !important;
    }

    body,
    .editor-backdrop,
    .editor-shell,
    .editor-body,
    .preview-stage {
        padding: 0 !important;
        overflow: visible !important;
        background: #fff !important;
    }

    .editor-pane {
        display: none !important;
    }

    .editor-pane.preview-pane {
        display: block !important;
    }

    .pdf-preview {
        width: 100%;
        min-height: 0;
        padding: 10mm;
        box-shadow: none;
    }
}
