/* ==========================================================================
   Phase 4 permit templates — Timeline / Contractors / Permit detail
   ========================================================================== */

.permit-hero {
    padding: 32px 0 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.permit-breadcrumb {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 12px;
}
.permit-breadcrumb a {
    color: #475569;
    text-decoration: none;
}
.permit-breadcrumb a:hover { text-decoration: underline; }
.permit-breadcrumb [aria-hidden="true"] {
    margin: 0 6px;
    color: #cbd5e1;
}
.permit-breadcrumb [aria-current="page"] { color: #0f172a; font-weight: 500; }

.permit-title {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.2;
    margin: 0 0 12px;
    color: #0f172a;
}
@media (min-width: 768px) {
    .permit-title { font-size: 36px; }
}
.permit-title-sub {
    font-weight: 500;
    color: #475569;
    font-size: 0.85em;
    display: block;
    margin-top: 4px;
}

.permit-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    font-size: 14px;
    color: #475569;
}
.permit-hero-permitnum {
    font-family: 'Inter', system-ui, sans-serif;
    font-weight: 600;
    color: #0f172a;
}

/* -----------------------------------------------------------------------------
   Status badge
   -------------------------------------------------------------------------- */
.permit-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    background: #e2e8f0;
    color: #334155;
    border: 1px solid rgba(0, 0, 0, 0.05);
}
.permit-status-applied     { background: #fef3c7; color: #78350f; border-color: #fcd34d; }
.permit-status-issued      { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.permit-status-inprogress  { background: #ede9fe; color: #5b21b6; border-color: #c4b5fd; }
.permit-status-complete    { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.permit-status-cancelled   { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }

/* -----------------------------------------------------------------------------
   Body grid + cards
   -------------------------------------------------------------------------- */
.permit-body { padding: 28px 0 40px; }
.permit-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: 1fr;
}
@media (min-width: 900px) {
    .permit-grid { grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); }
}

.permit-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px 22px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.permit-card h2 {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 14px;
}
.permit-card:last-child { margin-bottom: 0; }

.permit-thin { background: #f8fafc; border-style: dashed; }
.permit-thin h2 { color: #475569; }
.permit-empty { color: #64748b; font-size: 14px; }

.permit-callout {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
}
.permit-callout-warn {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #78350f;
}
.permit-callout strong { color: inherit; }

/* -----------------------------------------------------------------------------
   Details definition list
   -------------------------------------------------------------------------- */
.permit-details {
    display: grid;
    grid-template-columns: minmax(120px, 32%) 1fr;
    row-gap: 8px;
    column-gap: 16px;
    margin: 0;
    font-size: 15px;
}
.permit-details dt {
    color: #64748b;
    font-weight: 500;
}
.permit-details dd {
    color: #0f172a;
    margin: 0;
    font-weight: 500;
}
.permit-details dd a { color: #1d4ed8; text-decoration: none; }
.permit-details dd a:hover { text-decoration: underline; }

/* -----------------------------------------------------------------------------
   Stats grid (Template A top numbers, B2 scorecard)
   -------------------------------------------------------------------------- */
.permit-stats-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: 1fr;
    margin-bottom: 20px;
}
@media (min-width: 640px) {
    .permit-stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
    .permit-stats-grid { grid-template-columns: repeat(3, 1fr); }
}

.permit-stat {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px 18px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.permit-stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 8px;
}
.permit-stat-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
    color: #0f172a;
}
.permit-stat-sub {
    margin-top: 6px;
    font-size: 13px;
    color: #64748b;
}

/* -----------------------------------------------------------------------------
   Inspection timeline
   -------------------------------------------------------------------------- */
.permit-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}
.permit-timeline::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: #e2e8f0;
}
.permit-timeline-item {
    position: relative;
    padding: 4px 0 14px 28px;
}
.permit-timeline-marker {
    position: absolute;
    left: 0;
    top: 8px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #cbd5e1;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px #cbd5e1;
}
.permit-timeline-pass .permit-timeline-marker {
    background: #22c55e;
    box-shadow: 0 0 0 2px #86efac;
}
.permit-timeline-deficiency .permit-timeline-marker {
    background: #f97316;
    box-shadow: 0 0 0 2px #fdba74;
}
.permit-timeline-stage {
    font-weight: 600;
    color: #0f172a;
    font-size: 15px;
}
.permit-timeline-discipline {
    color: #64748b;
    font-weight: 400;
    font-size: 14px;
}
.permit-timeline-meta {
    font-size: 13px;
    color: #64748b;
    margin-top: 2px;
}

/* -----------------------------------------------------------------------------
   Permit table (recent examples, contractor portfolio, community rank)
   -------------------------------------------------------------------------- */
.permit-table-wrap {
    overflow-x: auto;
    margin: 0 -6px;
}
.permit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 560px;
}
.permit-table thead th {
    text-align: left;
    padding: 8px 10px;
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.permit-table tbody td {
    padding: 10px;
    border-bottom: 1px solid #f1f5f9;
    color: #0f172a;
}
.permit-table tbody tr:last-child td { border-bottom: none; }
.permit-table a { color: #1d4ed8; text-decoration: none; }
.permit-table a:hover { text-decoration: underline; }
.permit-contractor-rank .permit-rank {
    font-weight: 700;
    color: #64748b;
    width: 40px;
}

/* -----------------------------------------------------------------------------
   Chip cloud (sibling permit types, contractor communities)
   -------------------------------------------------------------------------- */
.permit-chip-cloud {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.permit-chip-cloud a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    color: #0f172a;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s;
}
.permit-chip-cloud a:hover { background: #dbeafe; border-color: #93c5fd; }
.permit-chip-count {
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
}

/* -----------------------------------------------------------------------------
   Sidebar (Template C — related permits + contractor)
   -------------------------------------------------------------------------- */
.permit-side .permit-card { padding: 16px 18px; }
.permit-related h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; color: #475569; margin-bottom: 10px; }
.permit-related-list { list-style: none; margin: 0 0 10px; padding: 0; }
.permit-related-list li { border-bottom: 1px solid #f1f5f9; padding: 8px 0; }
.permit-related-list li:last-child { border-bottom: none; }
.permit-related-list a { display: block; color: #0f172a; text-decoration: none; }
.permit-related-list a:hover strong { color: #1d4ed8; }
.permit-related-list strong { display: block; font-size: 14px; font-weight: 600; }
.permit-related-meta { font-size: 12px; color: #64748b; }
.permit-side-link {
    display: inline-block;
    margin-top: 8px;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}
.permit-side-link:hover { text-decoration: underline; }

/* -----------------------------------------------------------------------------
   Footer note
   -------------------------------------------------------------------------- */
.permit-footer-note {
    padding: 20px 0 40px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}
.permit-disclaimer {
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
    margin: 0 0 10px;
}
.permit-corrections {
    font-size: 13px;
    color: #475569;
    margin: 0;
}
.permit-corrections a { color: #1d4ed8; }
