:root {
    font-family: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --ink: #191c2e;
    --muted: #606a7e;
    --brand: #bc2537;
    --brand-hover: #9f1b2d;
    --surface: #fff;
    --line: #e4e8f1;
    --radius: 16px;
    --canvas: #f4f6fb;
    --nav: #24283c;
    --nav-muted: #c1c9db;
    color: var(--ink);
    background: var(--canvas);
}
body { font-size: .9rem; line-height: 1.55; }
h1 { font-weight: 700; letter-spacing: -.04em; }
h2, h3 { font-weight: 600; }
.topbar { min-height: 70px; background: #fff; border-color: var(--line); }
.topbar-context { display: flex; align-items: center; gap: 16px; }
.topbar-context > a { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); font-size: .86rem; font-weight: 600; }
.avatar { background: #f8e8eb; color: var(--brand-hover); }
.sidebar { background: var(--nav); border-color: #30364c; padding-inline: 13px; }
.sidebar .brand { background: white; border: 1px solid #f1eef0; border-radius: 9px; margin: 4px 10px 25px; }
.sidebar .workspace-label, .sidebar-footer { color: var(--nav-muted); }
.sidebar nav a, .sidebar-group summary { color: #e8ecf4; font-weight: 500; }
.sidebar nav a:hover, .sidebar-group summary:hover { background: #343b54; }
.sidebar-group[open] summary { background: #30374e; }
.sidebar nav a.current { background: #f9e7eb; color: #921d30; font-weight: 600; }
.sidebar-links { border-color: #47506a; }
.sidebar nav .sidebar-links a { min-height: 38px; }
.panel { border-color: var(--line); box-shadow: 0 6px 22px #27335408; }
.page-heading { align-items: center; padding: 13px 0 5px; }
.page-heading-title { display: flex; align-items: center; gap: 13px; min-width: 0; }
.page-heading-title h1 { font-size: clamp(1.3rem, 3vw, 2rem); }
.page-heading-icon { display: grid; place-items: center; flex: 0 0 46px; height: 46px; margin: 0; border-radius: 13px; background: #f9e8ee; color: #a52236; }
.page-heading-icon .nav-icon { width: 22px; height: 22px; }
.page-heading p { margin-top: 5px; font-size: .88rem; }
.button { border-color: #dce1ed; border-radius: 9px; font-weight: 600; font-size: .82rem; }
.button.primary { border-color: transparent; box-shadow: 0 3px 6px #ad243026; }
input, textarea, select, .select2-container .select2-selection--single { border-color: #dce1ed; }
label { font-weight: 600; }
.form-panel h2 > .nav-icon { color: var(--brand); margin-right: 4px; }
.hero, .quote-banner, .quote-detail-banner { background: linear-gradient(119deg,#25283d,#34283d 62%,#523044); }
.metric { background: var(--surface); border-color: var(--line); box-shadow: 0 5px 16px #28365909; }
.metric-icon { background: var(--tint); }
.metric-label { font-weight: 600; }
.report-chart figcaption h3, .panel-title h2 { color: #25283e; }
.customer-editor { display: grid; grid-template-columns: minmax(0, 1.64fr) minmax(240px, 1fr); align-items: start; gap: 16px; }
.customer-services-form { position: sticky; top: 15px; }
.company-actions { margin-bottom: 14px; }
.company-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin-bottom: 15px; }
.company-count { display: flex; align-items: center; gap: 10px; padding: 14px; min-width: 0; }
.company-count div { display: grid; }
.company-count strong { font-size: 1.23rem; line-height: 1.2; }
.company-count div span { color: var(--muted); font-size: .73rem; }
.company-overview { margin-bottom: 16px; }
div.dt-container .dt-layout-row { padding-inline: 17px; }
div.dt-container .dt-layout-row:first-of-type { padding-block: 12px 9px; }
div.dt-container .dt-search { display: flex; align-items: center; gap: 7px; }
div.dt-container .dt-search label, div.dt-container .dt-length { color: var(--muted); font-weight: 500; font-size: .78rem; }
div.dt-container .dt-search input { margin: 0; background: #f7f8fd; padding-inline: 12px; }
div.dt-container .dt-info { color: var(--muted); font-size: .78rem; }
div.dt-container .dt-paging .dt-paging-button { font-size: .78rem; }
.grid-tools { padding: 12px 17px; border-bottom: 1px solid var(--line); background: #f9fafd; border-radius: 14px 14px 0 0; align-items: center; }
.grid-filter-toggle::after { content: '▾'; color: var(--muted); }
.grid-filter-toggle[aria-expanded="true"] { background: #edf1fa; }
.grid-filter-toggle[aria-expanded="true"]::after { content: '▴'; }
.grid-filter-panel { flex: 0 0 100%; display: grid; gap: 7px; padding-top: 3px; }
.grid-filter-panel[hidden] { display: none; }
.grid-filter-panel > button { justify-self: start; }
.grid-filter-panel .grid-filter-fields { grid-template-columns: repeat(auto-fit,minmax(min(136px,100%),1fr)); }
.grid-filter-count { display: inline-flex; margin-left: 7px; min-width: 20px; min-height: 20px; align-items: center; justify-content: center; border-radius: 9px; color: #9b1f33; background: #f7e3ec; }
.grid-filter-count[hidden] { display: none; }
.grid-filter-fields { background: white; border: 1px solid var(--line); padding: 11px; }
.grid-filter-fields input { font-size: .88rem; }
.grid-export { background: #edf6f1; border-color: #cee7d9; color: #215f44; }
.grid-export:hover { background: #dfefe7; }
.data-grid thead th { background: #edf1fa; color: #3e4964; font-size: .78rem; font-weight: 600; padding-block: 11px; }
.data-grid tbody td { font-size: .82rem; padding-block: 13px; }
.data-grid tbody td:first-child { font-weight: 600; }
.data-grid tbody tr:nth-child(even) { background: #f9fafe; }
.data-grid tbody tr:hover { background: #f3f6fc; }
.grid-link { background: #f9edf1; border-color: #f0dce4; min-height: 38px; font-weight: 600; }
.grid-link:hover { background: #f5dfe6; }
@media (max-width: 740px) {
    .topbar { min-height: 58px; }
    .topbar-context { display: none; }
    .page-heading-icon { flex-basis: 40px; height: 40px; }
    .customer-editor { grid-template-columns: minmax(0,1fr); }
    .customer-services-form { position: static; }
    .company-metrics { gap: 6px; }
    .company-count { padding: 7px; gap: 5px; }
    .company-count .stream-icon { width: 22px; height: 22px; }
    .company-count .stream-icon .nav-icon { width: 15px; height: 15px; }
    .company-count div span { font-size: .63rem; }
    .company-count strong { font-size: .95rem; }
    div.dt-container .dt-layout-row, .grid-tools { padding-inline: 10px; }
    .grid-tools { gap: 5px; }
    .grid-tools .button { min-height: 39px; font-size: .75rem; padding-inline: 8px; }
    .data-grid tbody tr { margin: 7px 10px; border: 1px solid var(--line); border-radius: 11px; }
    .data-grid tbody td { padding-block: 6px; }
}
@media print {
    body { background: white; }
}
/* Keep the existing colored mark on light surfaces and use its white treatment on the dark menu. */
.sidebar .brand { background: transparent; border-color: transparent; }
.sidebar .brand img { filter: grayscale(1) brightness(.72) contrast(3) invert(1); mix-blend-mode: screen; }
.customer-hero { min-height: 170px; align-items: end; }
.customer-hero h1 { font-size: clamp(1.75rem,4vw,3rem); }
.customer-hero .eyebrow { text-transform: none; letter-spacing: .025em; }
.customer-quick { display: grid; grid-template-columns: repeat(auto-fit,minmax(195px,1fr)); gap: 12px; margin: 15px 0; }
.customer-counter { display: flex; align-items: center; gap: 10px; padding: 12px; }
.customer-counter:hover { background: #fdfbfe; border-color: #d8deef; }
.customer-counter div { display: grid; min-width: 0; }
.customer-counter div span { color: var(--muted); font-size: .75rem; }
.customer-counter strong { font-weight: 650; }
.customer-dashboard { display: grid; grid-template-columns: minmax(0,1.32fr) minmax(0,1fr); gap: 14px; align-items: start; }
.customer-dashboard > section { scroll-margin-top: 76px; }
.customer-tickets { grid-row: span 2; }
.ticket-editor { display: grid; grid-template-columns: minmax(0,1.65fr) minmax(225px,1fr); align-items: start; gap: 15px; }
.ticket-company { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #f5f3fc; border-radius: 10px; }
.ticket-company > div { display: grid; overflow-wrap: anywhere; }
.ticket-company small { color: var(--muted); }
.ticket-character-count { justify-self: end; font-size: .74rem; margin-block: -10px 0; }
.ticket-tips ul { padding-inline-start: 19px; margin-block: 0 14px; }
.ticket-tips li + li { margin-top: 8px; }
.ticket-tips p { font-size: .83rem; }
@media (max-width: 740px) {
    .customer-hero { align-items: start; }
    .customer-dashboard, .ticket-editor { grid-template-columns: minmax(0,1fr); }
    .customer-tickets { grid-row: auto; }
    .customer-quick { grid-template-columns: repeat(auto-fit,minmax(min(140px,100%),1fr)); gap: 7px; }
    .customer-counter { min-height: 63px; }
    .customer-dashboard .panel-title { gap: 7px; }
    .customer-dashboard .panel-title .text-link { text-align: right; white-space: nowrap; }
}

.grid-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.grid-actions .grid-link { flex: none; justify-content: center; width: 33px; min-height: 33px; padding: 0; }
.grid-actions .nav-icon { width: 17px; height: 17px; }
.grid-actions .grid-edit { color: #34356b; background: #efeff9; border-color: #e0e0f2; }
.grid-actions .grid-edit:hover { background: #e4e4f5; }
.grid-actions .grid-delete { color: #a31720; background: #fff; border-color: #edd8dd; }
.grid-actions .grid-delete:hover { background: #f9edf1; }
.delete-panel { max-width: 600px; }
.delete-panel h1 { font-size: 1.4rem; margin-bottom: 8px; }
.delete-panel h2 { overflow-wrap: anywhere; }
.delete-panel .actions, .save-confirmation .actions { margin-top: 16px; }
.button.danger { color: #fff; background: #a31720; border-color: #a31720; }
.button.danger:hover { background: #85131c; border-color: #85131c; }
.save-confirmation {
    width: min(420px, calc(100vw - 32px));
    padding: 21px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
    box-shadow: 0 18px 48px #22233e33;
}
.save-confirmation::backdrop { background: #191b2e80; }
.delete-confirmation { padding: 0; }
.delete-confirmation .delete-panel { padding: 20px; border: 0; box-shadow: none; }
.delete-confirmation .actions { justify-content: flex-end; }
.copy-field { grid-column: 1 / -1; }
.detail-grid .copy-field dd { white-space: normal; }
.copy-value { display: flex; flex-wrap: wrap; align-items: center; gap: 9px 12px; }
.copy-value [data-copy-text] { min-width: 0; overflow-wrap: anywhere; }
.copy-value [data-copy-status]:empty { display: none; }
.data-grid thead th { overflow-wrap: normal; }
@media (min-width: 741px) {
    table.data-grid thead .grid-actions-column { width: 134px; text-align: right; }
    table.data-grid thead .grid-actions-column .dt-column-header { justify-content: flex-end; }
    table.reports-grid { table-layout: fixed; }
    .reports-grid thead th:nth-child(1) { width: 22%; }
    .reports-grid thead th:nth-child(2) { width: 135px; }
    .reports-grid thead th:nth-child(3) { width: 110px; }
    .reports-grid tbody td[data-label="Servis tarihi"] { white-space: nowrap; }
}

.quote-banner, .quote-document-head { padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.quote-banner h1, .quote-document-head h1 { min-width: 0; font-size: clamp(1.35rem, 3vw, 1.88rem); font-weight: 600; letter-spacing: -.025em; }
.quote-editor { gap: 12px; font-size: .875rem; }
.quote-editor .panel, .quote-document .panel { border-radius: 10px; box-shadow: none; }
.quote-editor .stack, .quote-editor .form-stack, .quote-editor .form-grid { gap: 10px; }
.quote-editor .form-panel { padding: 14px; }
.quote-editor h2 { font-size: .98rem; margin-bottom: 8px; }
.quote-section-head { margin-bottom: 9px; }
.quote-section-head h2 { margin: 0; }
.quote-editor label, .quote-editor .button { font-size: .825rem; }
.quote-editor .quote-line { padding: 9px; }
.quote-editor textarea { padding: 7px 9px; }
.quote-calculation div { padding-block: 6px; }
.quote-calculation div:has(+ .quote-grand-total) { border-bottom: 0; }
.quote-calculation div.quote-grand-total { padding: 9px 0 5px; }
.quote-calculation .quote-grand-total dd { color: #a31720; }
@media (min-width: 821px) {
    .quote-editor input, .quote-editor select, .quote-editor .button,
    .quote-editor .select2-container .select2-selection--single, .quote-editor .quote-line output { min-height: 37px; }
    .quote-editor input, .quote-editor select { padding: 6px 9px; font-size: .875rem; }
    .quote-editor .select2-container .select2-selection--single .select2-selection__rendered { line-height: 35px; }
    .quote-editor .select2-container .select2-selection--single .select2-selection__arrow { height: 35px; }
}
@media (max-width: 820px) {
    .grid-actions .grid-link { width: 44px; min-height: 44px; }
    .quote-editor .form-panel { padding: 12px; }
    .quote-editor input, .quote-editor select, .quote-editor textarea { font-size: 16px; }
}

#home-calendar { margin-top: 0; }
.calendar-event-row { display: flex; align-items: stretch; gap: 3px; margin-top: 4px; }
.calendar-event-row .calendar-item { flex: 1; min-width: 0; margin-top: 0; }
.calendar-delete {
    display: grid;
    flex: none;
    place-items: center;
    color: #a31720;
    background: #fbf0f2;
    border-radius: 6px;
}
.calendar-delete:hover { background: #f4dce2; }
.calendar-event-row .calendar-delete { width: 23px; }
.calendar-event-row .calendar-delete .nav-icon { width: 14px; height: 14px; }
.agenda-entry { display: flex; align-items: center; gap: 6px; }
.agenda-entry .stream-row { flex: 1; min-width: 0; }
.agenda-entry .calendar-delete { width: 44px; height: 44px; margin-right: 9px; }

.quote-document-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.quote-document { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 340px); gap: 12px; align-items: start; }
.quote-document-parties, .quote-document-items { grid-column: 1 / -1; }
.quote-document-parties { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px; }
.quote-document-parties h2 { color: var(--muted); font-size: .78rem; margin-bottom: 4px; }
.quote-document-parties > dl:only-child { grid-column: 1 / -1; }
.quote-document-parties p, .quote-document-items td { overflow-wrap: anywhere; }
.quote-document-parties p { font-size: .83rem; }
.quote-document-items .panel-title { border-bottom: 1px solid var(--line); }
.quote-document-items .data-grid thead th { color: #3b414a; background: #f4f5f7; }
.quote-document-items td small { display: block; color: var(--muted); font-weight: 400; font-size: .74rem; }
.quote-document-summary { grid-column: 2; grid-row: 3 / span 2; }
.quote-document-summary .quote-grand-total dd { font-size: 1.08rem; font-variant-numeric: tabular-nums; }
.quote-document-note { grid-column: 1; }
.quote-pdf-preview { padding: clamp(8px, 2vw, 22px); border: 1px solid var(--line); border-radius: 10px; background: #e9ecf1; }
.quote-pdf-status { padding: 12px; text-align: center; }
.quote-pdf-pages { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 12px; }
.quote-pdf-page { display: block; width: min(100%, 840px); height: auto; margin: 0 auto; background: white; box-shadow: 0 3px 12px #22283814; }
.quote-pdf-preview [hidden] { display: none; }
@media (min-width: 741px) {
    .quote-document-items .records :is(th, td):nth-child(n+2) { text-align: right; }
}
@media (max-width: 740px) {
    .quote-document, .quote-document-parties { grid-template-columns: minmax(0, 1fr); }
    .quote-document-summary { grid-column: auto; grid-row: auto; }
    .quote-document-head .actions { width: 100%; }
}

.top-rates { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 3px 5px; min-width: 0; }
.top-rates-values { display: flex; align-items: center; gap: 6px; }
.top-rate { display: inline-flex; align-items: baseline; gap: 4px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 6px; white-space: nowrap; font-size: .72rem; }
.top-rate > span { color: var(--muted); }
.top-rate strong { font-weight: 650; font-variant-numeric: tabular-nums; }
.top-rates-updated { color: var(--muted); font-size: .67rem; line-height: 1.2; }
.top-rates-updated time { font-variant-numeric: tabular-nums; }
.top-rates .top-rates-refresh { grid-area: 1 / 2 / 3 / 3; width: 32px; height: 32px; color: #a31720; }
.top-rates [data-refresh-rates] .nav-icon { width: 16px; height: 16px; }
.top-rates:is([data-rates-state="stale"],[data-rates-state="error"]) .top-rates-refresh { background: #fff3dd; color: #774805; }
@media (max-width: 740px) {
    .topbar { display: grid; grid-template-columns: auto auto minmax(0,1fr); grid-template-rows: 52px 51px; gap: 0 7px; padding-block: 0; }
    .top-rates { grid-area: 2 / 1 / 3 / -1; align-content: center; border-top: 1px solid var(--line); align-self: stretch; }
    .top-rates-values { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
    .top-rate { display: grid; gap: 0; padding: 2px 3px; line-height: 1.25; text-align: center; font-size: .66rem; }
    .top-rates .top-rates-refresh { width: 36px; height: 36px; }
    .sidebar.visible { top: 104px; }
    .customer-dashboard > section, #home-calendar { scroll-margin-top: 113px; }
}

.billing-details { display: grid; grid-template-columns: minmax(0,1.8fr) minmax(220px,1fr); align-items: start; gap: 12px; }
.billing-record-data { margin: 0; }
.billing-description { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 13px; }
.billing-state { display: grid; gap: 10px; justify-items: start; }
.billing-state h2, .billing-state .detail-grid { margin: 0; }
.billing-state .detail-grid { grid-template-columns: 1fr; }
@media (max-width: 740px) {
    .billing-details { grid-template-columns: minmax(0, 1fr); }
}

.billing-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.billing-tabs .billing-tab-active { color: #921d30; background: #fae9ee; border-color: #e8b4c1; }
.billing-filters { align-items: end; }
.billing-company-filter { flex: 1 1 190px; max-width: 310px; min-width: 0; }
.billing-date-filters { border: 0; padding: 0; margin: 0; min-width: 0; }
.billing-date-filters legend { color: var(--muted); font-size: .75rem; }
.billing-date-filters > div { display: flex; flex-wrap: wrap; gap: 6px; }
.billing-date-filters label { flex: 1 1 125px; min-width: 0; }
@media (max-width: 740px) {
    .billing-filters { padding-inline: 12px; }
    .billing-company-filter { flex-basis: 100%; max-width: none; }
    .billing-date-filters { flex-basis: 100%; }
    .billing-date-filters input { max-width: none; font-size: 16px; }
}

.license-expiry-soon { display: inline-flex; align-items: center; justify-self: start; gap: 5px; padding: 2px 8px; border: 1px solid #ecd09b; border-radius: 7px; background: #fff1d5; color: #74450d; font-weight: 650; white-space: nowrap; }
.license-expiry-soon::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.report-description-field { display: grid; gap: 7px; }
.report-description-field textarea { line-height: 1.55; max-height: 65vh; }
.report-description-field .subtle { justify-self: end; font-size: .75rem; }

.analytics-filters { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; padding: 13px; }
.analytics-filters label { flex: 0 1 156px; min-width: 0; }
.analytics-filters .analytics-company { flex: 1 1 215px; max-width: 310px; }
.analytics-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-block: 13px; }
.analytics-metric { display: flex; align-items: center; gap: 9px; padding: 12px; }
.analytics-metric .metric-icon { flex: none; }
.analytics-metric div { display: grid; min-width: 0; }
.analytics-metric div span { color: var(--muted); font-size: .76rem; }
.analytics-metric strong { font-size: 1.26rem; font-variant-numeric: tabular-nums; }
.analytics-trend { margin-bottom: 12px; }
.analytics-trend figcaption { flex-wrap: wrap; }
.analytics-legend { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: .76rem; }
.analytics-legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 4px; border-radius: 3px; background: #4f6ddb; }
.analytics-legend span + span::before { background: #b44263; }
.analytics-scroll { overflow-x: auto; }
.analytics-bars { display: grid; grid-template-columns: repeat(var(--periods), minmax(34px, 1fr)); gap: 4px; margin: 10px 0 0; padding: 0; min-width: calc(var(--periods) * 40px); list-style: none; }
.analytics-bars li { min-width: 0; text-align: center; font-size: .72rem; }
.analytics-bar-group { display: flex; justify-content: center; align-items: end; gap: 4px; height: 134px; padding-inline: 3px; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to top,#eaf0fa 0 1px,transparent 1px 33px); }
.analytics-bar-group i { width: min(30%, 24px); height: var(--value); border-radius: 4px 4px 0 0; background: #4f6ddb; }
.analytics-bar-group i + i { background: #b44263; }
.analytics-counts { margin-top: 12px; color: var(--muted); font-size: .8rem; }
.analytics-counts summary { cursor: pointer; }
.analytics-counts-table { width: 100%; margin-top: 5px; border-collapse: collapse; text-align: start; }
.analytics-counts-table th, .analytics-counts-table td { padding: 4px; border-bottom: 1px solid var(--line); text-align: start; }
.analytics-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.analytics-ranking .chart-rank span { overflow-wrap: anywhere; }
@media (max-width: 740px) {
    .analytics-charts { grid-template-columns: minmax(0, 1fr); }
    .analytics-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    .analytics-filters label { flex: 1 1 120px; }
    .analytics-filters .analytics-company { flex-basis: 100%; max-width: none; }
    .analytics-filters input { font-size: 16px; }
    .analytics-metric { padding: 8px; }
    .analytics-metric .metric-icon { width: 28px; height: 28px; }
}

.service-report { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(220px, 1fr); align-items: start; gap: 12px; }
.service-report .stack { gap: 12px; }
.service-report-work { border-top: 2px solid #5475de; }
.service-report-request .detail-grid { margin-top: 12px; }
.service-report-details .detail-grid { grid-template-columns: minmax(0, 1fr); gap: 9px; }
.service-report-details .detail-grid > div + div { padding-top: 7px; border-top: 1px solid var(--line); }
@media (max-width: 740px) {
    .service-report { grid-template-columns: minmax(0, 1fr); }
}

.analytics-report-table { margin-bottom: 12px; }
