/* ---- Base ---- */

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f5f7f9;
    color: #17212b;
}

/* ---- Header / nav ---- */

.hz-header {
    background: #008c95; /* nice teal */
    color: #fff;
    padding: 0.4rem 1.2rem; /* compact header height */
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.hz-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hz-logo {
    height: 44px; /* slightly smaller for compact header */
}

.hz-header-title h1 {
    margin: 0;
    font-size: 1.4rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.hz-header-title p {
    margin: 0.1rem 0 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Subtitle line: "Holdson Internal Quoting Tool" */
.hz-header-subtitle {
    text-align: center;
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    margin-top: 0.2rem;
    margin-bottom: 0.25rem;
}

.hz-nav {
    margin-left: auto;
    display: flex;
    gap: 1rem;
}

.hz-nav a {
    color: #e9f9fa;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.hz-nav a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* ---- Layout ---- */

.hz-main {
    max-width: 1100px;
    margin: 1.5rem auto 2rem;
    padding: 0 1rem;
}

.hz-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 1.75rem 1.75rem 2rem;
    box-shadow: 0 6px 18px rgba(15, 52, 75, 0.08);
}

.hz-card-narrow {
    max-width: 420px;
    margin: 2rem auto;
}

.hz-quote-card {
    padding: 1.5rem 1.5rem 2rem;
}

/* ---- Typography / forms ---- */

.hz-subtitle {
    margin-top: 0.25rem;
    color: #5f6b76;
    font-size: 0.95rem;
}

.hz-section {
    margin-top: 1.5rem;
    border-top: 1px solid #e3e7ec;
    padding-top: 1.2rem;
}

.hz-section h3 {
    margin-top: 0;
    font-size: 1.1rem;
    color: #04788a;
}

label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: #1f2a33;
}

input[type="text"],
input[type="number"],
input[type="password"],
textarea,
select {
    width: 100%;
    border-radius: 9px;
    border: 1px solid #ccd3dd;
    padding: 0.4rem 0.55rem;
    font-size: 0.9rem;
    box-sizing: border-box;
    background: #fbfcfe;
}

textarea {
    resize: vertical;
}

small {
    font-size: 0.75rem;
    color: #7a8590;
}

/* ---- Grids ---- */

.hz-grid-2,
.hz-grid-3,
.hz-grid-4 {
    display: grid;
    gap: 1rem;
}

.hz-grid-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.hz-grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.hz-grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.hz-material-grid .hz-material-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

/* ---- Buttons ---- */

.hz-section-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.25rem;
}

/* Base pill button */
.hz-btn,
.hz-btn-primary,
.hz-btn-secondary,
.hz-btn-ghost,
.hz-btn-success,
.hz-btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.9rem;
    font-size: 0.8rem;
    border-radius: 999px;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.2;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
}

/* Primary (default teal) */
.hz-btn-primary,
.hz-btn:not(.hz-btn-secondary):not(.hz-btn-ghost):not(.hz-btn-success):not(.hz-btn-danger) {
    background: #00a5aa;
    border-color: #00848a;
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(0, 165, 170, 0.25);
}

.hz-btn-primary:hover,
.hz-btn:hover {
    background: #008a8e;
    border-color: #006d72;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 165, 170, 0.32);
}

/* Secondary (soft teal) */
.hz-btn-secondary {
    background: #e5f4f6;
    border-color: #c3e4e7;
    color: #046873;
    font-weight: 500;
}

.hz-btn-secondary:hover {
    background: #d2e7ea;
    border-color: #b0d9dd;
    transform: translateY(-1px);
}

/* Ghost button (neutral outline) */
.hz-btn-ghost {
    background: transparent;
    border-color: rgba(134, 142, 150, 0.5);
    color: #495057;
    font-weight: 500;
}

.hz-btn-ghost:hover {
    background: rgba(241, 243, 245, 0.9);
    transform: translateY(-1px);
}

/* Success (Accept) */
.hz-btn-success {
    background: #37b24d;
    border-color: #2b8a3e;
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(55, 178, 77, 0.25);
}

.hz-btn-success:hover {
    background: #2f9e44;
    border-color: #2b8a3e;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(55, 178, 77, 0.35);
}

/* Danger (Reject) */
.hz-btn-danger {
    background: #f03e3e;
    border-color: #c92a2a;
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(240, 62, 62, 0.25);
}

.hz-btn-danger:hover {
    background: #e03131;
    border-color: #c92a2a;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(240, 62, 62, 0.35);
}

/* Small variant */
.hz-btn-small {
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
}

/* ---- Flash messages ---- */

.flash-container {
    margin-bottom: 1rem;
}

.flash {
    padding: 0.6rem 0.9rem;
    border-radius: 9px;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

.flash-success { background: #e4f7eb; color: #145c2e; }
.flash-danger  { background: #ffe7e7; color: #872121; }
.flash-info    { background: #e5f2ff; color: #174a7a; }

/* ---- Misc spacing ---- */

.hz-notes-label {
    margin-top: 0.4rem;
}

.hz-mt {
    margin-top: 1rem;
}

/* ---- Quote view ---- */

.hz-quote-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid #dde4ed;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
}

.hz-quote-header h2 {
    margin: 0 0 0.25rem;
}

.hz-quote-ref p {
    margin: 0;
    font-size: 0.85rem;
}

.hz-quote-image {
    margin: 0.75rem 0 1rem;
    text-align: right;
}

.hz-quote-image img {
    max-width: 220px;
    border-radius: 8px;
    border: 1px solid #e0e6ee;
}

.hz-quote-section {
    margin-top: 1rem;
}

.hz-quote-section h3 {
    margin-bottom: 0.35rem;
}

.hz-total {
    font-size: 1.05rem;
    margin-top: 0.4rem;
}

.hz-quote-footnote {
    font-size: 0.8rem;
    color: #6a7682;
    margin-top: 0.75rem;
}

.hz-print-btn {
    margin-top: 0.75rem;
}

/* ---- Markdown inside quote ---- */

.hz-quote-markdown h2,
.hz-quote-markdown h3 {
    margin-top: 0.6rem;
    margin-bottom: 0.3rem;
}

.hz-quote-markdown p {
    margin: 0.2rem 0;
}

.hz-quote-markdown ul {
    margin: 0.25rem 0 0.25rem 1.2rem;
    padding-left: 1.2rem;
}

.hz-quote-markdown li {
    margin: 0.15rem 0;
}

.hz-quote-actions {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ---- Table for saved quotes ---- */

.hz-table-wrapper {
    margin-top: 1rem;
    overflow-x: auto;
}

.hz-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.hz-table th,
.hz-table td {
    padding: 0.25rem 0.35rem;
    border-bottom: 1px solid #e3e7ec;
    text-align: left;
}

.hz-table tr:hover {
    background: #f2f6f9;
    cursor: pointer;
}

.hz-table-actions a {
    font-size: 0.85rem;
}

/* Let longer text wrap so the table doesn't blow out */
.hz-table th:nth-child(2),
.hz-table td:nth-child(2),
.hz-table th:nth-child(3),
.hz-table td:nth-child(3),
.hz-table th:nth-child(4),
.hz-table td:nth-child(4) {
    white-space: normal;
}

/* Quote number column */
.hz-table th:nth-child(1),
.hz-table td:nth-child(1) {
    max-width: 90px;
}

/* Actions column */
.hz-table th:nth-child(12),
.hz-table td:nth-child(12) {
    max-width: 180px;
}

/* Actual-hours column sizing */
.hz-table th:nth-child(9),
.hz-table td:nth-child(9) {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 130px !important;
}

/* Larger actual-hours input – still neat */
.hz-actual-input {
    width: 100% !important;
    min-width: 80px;
    padding: 0.3rem 0.45rem;
    border-radius: 6px;
    border: 1px solid #b9c4d0;
    font-size: 0.8rem;
    background: #fff;
    box-sizing: border-box;
}

.hz-actual-input:focus {
    outline: none;
    border-color: #00a5aa;
    box-shadow: 0 0 0 2px rgba(0,165,170,0.15);
}

/* ---- Dashboard (old stat cards, still used in some templates) ---- */

.hz-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
}

.hz-stat-card {
    background: #f5fbfc;
    border-radius: 12px;
    padding: 0.9rem 1rem;
    border: 1px solid #dde8ea;
}

.hz-stat-card h3 {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    color: #04788a;
}

.hz-stat-main {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.hz-stat-sub {
    margin: 0.1rem 0 0;
    font-size: 0.8rem;
    color: #6a7682;
}

/* ---- New KPI-style dashboard ---- */

.dashboard-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.2rem;
    margin-top: 1rem;
}

.dashboard-kpis .kpi-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 1.1rem 1.25rem;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(15, 123, 130, 0.12);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 130px;
}

.kpi-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6c757d;
    margin-bottom: 0.3rem;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 800;
    color: #0f7b82;
    line-height: 1.1;
}

.kpi-sub {
    font-size: 0.9rem;
    color: #495057;
    margin-top: 0.2rem;
}

.kpi-meta {
    font-size: 0.8rem;
    color: #868e96;
    margin-top: 0.45rem;
}

/* Accent borders for specific KPI tiles */
.kpi-card-success {
    border-left: 4px solid #2f9e44;
}

.kpi-card-danger {
    border-left: 4px solid #e03131;
}

.kpi-card-warning {
    border-left: 4px solid #f08c00;
}

/* Chart cards */
.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.2rem;
    margin-top: 1rem;
}

.dashboard-charts .chart-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 1rem 1.25rem 1.4rem 1.25rem;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(15, 123, 130, 0.12);
}

.chart-card h4 {
    font-size: 0.95rem;
    margin-bottom: 0.6rem;
    color: #495057;
}

.chart-card canvas {
    max-width: 100%;
    height: 280px !important;
}

/* ---- Customer needs list ---- */

.needs-table td {
    vertical-align: middle;
    font-size: 0.9rem;
}

.needs-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.inline-form {
    display: inline-block;
    margin: 0;
}

/* ---- Badges ---- */

.hz-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.12rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid transparent;
}

.hz-badge-success {
    background: #e6fcf5;
    border-color: #37b24d;
    color: #2b8a3e;
}

.hz-badge-danger {
    background: #ffe3e3;
    border-color: #f03e3e;
    color: #c92a2a;
}

.hz-badge-warning {
    background: #fff4e6;
    border-color: #f08c00;
    color: #d9480f;
}

.hz-badge-neutral {
    background: #f1f3f5;
    border-color: #ced4da;
    color: #495057;
}

/* ---- Markdown editor (quote editing) ---- */

.hz-markdown-editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: stretch;
}

.hz-markdown-editor-pane {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.hz-markdown-editor-pane textarea {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.85rem;
}

.hz-markdown-preview {
    border-radius: 10px;
    border: 1px solid #d0d7e2;
    background: #f8fafc;
    padding: 0.75rem 1rem;
    max-height: 400px;
    overflow-y: auto;
    font-size: 0.9rem;
}

/* ---- Print ---- */

@media print {
    body {
        background: #fff;
    }
    .hz-header,
    .hz-nav,
    .hz-print-btn,
    .flash-container {
        display: none !important;
    }
    .hz-main {
        margin: 0;
        max-width: 100%;
        padding: 0;
    }
    .hz-card {
        box-shadow: none;
        border-radius: 0;
        padding: 0;
    }
}

/* --- Table link + action polish --- */

/* Make links in tables look deliberate, not default blue/underlined */
.hz-table a {
    colour: #0f7b82;
    text-decoration: none;
    font-weight: 500;
}

.hz-table a:hover {
    text-decoration: underline;
}

/* Keep action buttons in tables tight */
.hz-table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.needs-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* Make small buttons genuinely small in dense tables */
.hz-table .hz-btn-small {
    padding: 0.2rem 0.55rem;
    font-size: 0.75rem;
}

/* KPI number colours for customer needs */
.kpi-card-warning .kpi-value,
.kpi-card-danger .kpi-value {
    color: #e03131; /* strong red */
}

/* Make KPI cards clickable without looking like blue links */
.kpi-card-link {
    text-decoration: none;
    color: inherit;
}

.kpi-card-link:hover {
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.09);
    transform: translateY(-1px);
    cursor: pointer;
}
