/* ===== Reset & Base ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: Arial, sans-serif;
    background: #f4f4f4;
    color: #333;
    line-height: 1.6;
}

/* ===== Layout ===== */
.container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== Header ===== */
.site-header {
    background: #fff;
    border-bottom: 3px solid #E8720C;
    padding: 14px 0;
}
.header-flex {
    display: flex;
    align-items: center;
    gap: 16px;
}
.logo {
    font-size: 20px;
    font-weight: bold;
    color: #E8720C;
    flex: 1;
}
.header-sub {
    font-size: 14px;
    color: #666;
}
.logout-link {
    font-size: 13px;
    color: #666;
    text-decoration: none;
}
.logout-link:hover { color: #E8720C; }

/* ===== Hero ===== */
.hero {
    text-align: center;
    padding: 36px 0 20px;
}
.hero h1 {
    font-size: 28px;
    color: #222;
    margin-bottom: 8px;
}
.hero p { color: #666; }
.estimate-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.estimate-number {
    font-size: 13px;
    font-weight: bold;
    letter-spacing: .08em;
    background: #E8720C;
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
}
.estimate-title {
    font-size: 18px;
    font-weight: bold;
    color: #222;
}

/* ===== Cards ===== */
.card {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    padding: 24px;
    margin-bottom: 20px;
}
.card h2 {
    font-size: 17px;
    color: #E8720C;
    margin-bottom: 16px;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}
.card h3 {
    font-size: 15px;
    color: #222;
    margin-bottom: 8px;
}

/* ===== Section Headings ===== */
.section-heading {
    font-size: 20px;
    color: #222;
    margin: 28px 0 12px;
    border-left: 4px solid #E8720C;
    padding-left: 10px;
}

/* ===== Parameter Grid ===== */
.param-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}
.field label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    color: #555;
    margin-bottom: 6px;
}
.field input[type="number"],
.field select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 15px;
}
.field input[type="number"]:focus,
.field select:focus {
    outline: none;
    border-color: #E8720C;
}

/* ===== Toggle Group ===== */
.toggle-group {
    display: flex;
    gap: 16px;
    padding-top: 4px;
}
.toggle-opt {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    cursor: pointer;
}

/* ===== Textarea ===== */
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    resize: vertical;
}
textarea:focus {
    outline: none;
    border-color: #E8720C;
}

/* ===== Buttons ===== */
.btn-primary {
    background: #E8720C;
    color: #fff;
    border: none;
    padding: 11px 28px;
    border-radius: 4px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.btn-primary:hover { background: #cf640a; }
.btn-primary:disabled { background: #ccc; cursor: not-allowed; }

.btn-secondary {
    background: #fff;
    color: #E8720C;
    border: 2px solid #E8720C;
    padding: 9px 24px;
    border-radius: 4px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.btn-secondary:hover { background: #fff5ee; }

.btn-full { width: 100%; text-align: center; }
.btn-large { padding: 14px 40px; font-size: 16px; }

/* ===== Form Actions ===== */
.form-actions {
    display: flex;
    gap: 16px;
    align-items: center;
    margin: 24px 0;
}

/* ===== Alerts ===== */
.alert {
    padding: 14px 18px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert ul { margin: 8px 0 0 18px; }
.alert-error { background: #fdecea; border-left: 4px solid #c0392b; color: #922b21; }
.alert-warn  { background: #fef9e7; border-left: 4px solid #f39c12; color: #7d6608; }
.alert-ok    { background: #eafaf1; border-left: 4px solid #27ae60; color: #1e8449; }

/* ===== Estimate Table ===== */
.estimate-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.estimate-table th {
    background: #f0f0f0;
    text-align: left;
    padding: 10px 12px;
    font-size: 13px;
    color: #555;
    border-bottom: 2px solid #ddd;
}
.estimate-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}
.estimate-table tr:last-child td { border-bottom: none; }
td.ref   { color: #999; font-size: 12px; white-space: nowrap; }
td.price { text-align: right; font-weight: bold; white-space: nowrap; }

/* ===== Type Badges ===== */
.type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}
.type-labour         { background: #e8f4fd; color: #1a6fa0; }
.type-actual         { background: #eafaf1; color: #1e8449; }
.type-allowance      { background: #fef9e7; color: #7d6608; }
.type-licensed_trade { background: #f3e8fd; color: #6b21a8; }

/* ===== Summary Table ===== */
.summary-table-wrap { padding: 16px 24px; }
.summary-table {
    width: 100%;
    max-width: 360px;
    margin-left: auto;
    border-collapse: collapse;
    font-size: 15px;
}
.summary-table td {
    padding: 8px 4px;
    border-bottom: 1px solid #eee;
}
.summary-table td:last-child { text-align: right; font-weight: bold; }
.summary-table .total-row td {
    font-size: 17px;
    font-weight: bold;
    color: #E8720C;
    border-top: 2px solid #ddd;
    border-bottom: none;
    padding-top: 12px;
}

/* ===== Raw Output ===== */
.raw-output {
    background: #f9f9f9;
    border: 1px solid #ddd;
    padding: 12px;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
    margin-top: 10px;
    max-height: 300px;
    overflow-y: auto;
}

/* ===== Login ===== */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f4f4f4;
}
.login-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,.12);
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
}
.login-logo {
    font-size: 18px;
    font-weight: bold;
    color: #E8720C;
    margin-bottom: 4px;
}
.login-card h2 {
    font-size: 22px;
    color: #222;
    margin-bottom: 24px;
}
.login-card label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    color: #555;
    margin-bottom: 6px;
}
.login-card input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 15px;
    margin-bottom: 18px;
}
.login-card input[type="password"]:focus {
    outline: none;
    border-color: #E8720C;
}

/* ===== Questions List ===== */
.questions-list {
    margin: 0 0 0 20px;
    padding: 0;
}
.questions-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 15px;
    line-height: 1.5;
}
.questions-list li:last-child { border-bottom: none; }

/* ===== Scope Cards ===== */
.scope-card { position: relative; }
.scope-ref {
    display: inline-block;
    font-size: 11px;
    font-weight: bold;
    color: #fff;
    background: #E8720C;
    border-radius: 3px;
    padding: 1px 7px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.materials-list {
    margin-top: 10px;
    font-size: 13px;
    color: #666;
    border-top: 1px solid #f0f0f0;
    padding-top: 8px;
}
.item-note {
    font-size: 12px;
    color: #888;
    margin-top: 3px;
    font-style: italic;
}

/* ===== Back Link ===== */
.back-link {
    margin: 8px 0 32px;
    font-size: 14px;
}
.back-link a { color: #E8720C; text-decoration: none; }
.back-link a:hover { text-decoration: underline; }
