:root {
    --primary-color: #0f8f54;
    --primary-light: #27c27a;
    --secondary-color: #0f172a;
    --accent-color: #c89b4a;
    --bg-color: #eef2ee;
    --bg-accent: #e8efe8;
    --sidebar-color: #07110d;
    --text-primary: #15202b;
    --text-muted: #65707d;
    --glass-bg: rgba(255, 255, 255, 0.78);
    --glass-border: rgba(15, 143, 84, 0.12);
    --shadow: 0 18px 40px rgba(10, 20, 14, 0.12);
    --sidebar-text: #ffffff;
    --radius-lg: 18px;
    --transition-fast: 160ms ease;
    --transition-normal: 220ms ease;
}

.construction-preview-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 0 1rem 1rem;
}

.construction-preview-actions .btn {
    width: 100%;
    justify-content: center;
}

.construction-preview-card.is-offer .construction-preview-link,
.construction-preview-card.is-invoice .construction-preview-link {
    cursor: pointer;
    height: auto;
}

.construction-preview-card.is-offer .construction-preview-media,
.construction-preview-card.is-invoice .construction-preview-media {
    pointer-events: none;
}

.construction-preview-card.is-offer:hover,
.construction-preview-card.is-invoice:hover {
    border-color: rgba(15, 143, 84, 0.5);
    box-shadow: 0 12px 28px rgba(15, 143, 84, 0.14);
}

.construction-preview-card.is-unassigned .construction-preview-media {
    background: rgba(148, 163, 184, 0.14);
}

.badge-neutral,
.status-pill.status-neutral {
    background: rgba(148, 163, 184, 0.16);
    color: #475569;
}

.status-pill.status-warn {
    background: rgba(245, 158, 11, 0.16);
    color: #b45309;
}

.offer-summary {
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(16, 185, 129, 0.22);
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.06);
}

.unsaved-dialog {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: none;
    place-items: center;
    padding: 1rem;
    background: rgba(7, 17, 13, 0.62);
    backdrop-filter: blur(5px);
}

.unsaved-dialog.is-visible {
    display: grid;
}

.unsaved-dialog-card {
    width: min(520px, 100%);
    padding: 1.5rem;
    border-radius: 16px;
    background: #fff;
    border: 1px solid rgba(15, 143, 84, 0.2);
    box-shadow: 0 24px 60px rgba(7, 17, 13, 0.28);
    text-align: center;
}

.unsaved-dialog-card > i {
    margin-bottom: 0.75rem;
    color: #d97706;
    font-size: 2rem;
}

.unsaved-dialog-card p {
    margin: 0.5rem 0 1.25rem;
    color: var(--text-muted);
}

.unsaved-dialog-actions {
    display: grid;
    gap: 0.6rem;
}

.unsaved-dialog-actions .btn {
    width: 100%;
    justify-content: center;
}

.offer-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.offer-summary-grid div,
.offer-history-entry {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.offer-history-entry {
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.offer-history-entry p {
    margin: 0.35rem 0 0;
}

@media (max-width: 760px) {
    .offer-summary-grid {
        grid-template-columns: 1fr;
    }

    .construction-preview-actions {
        grid-template-columns: 1fr;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background:
        radial-gradient(circle at top left, rgba(15, 143, 84, 0.12), transparent 26%),
        radial-gradient(circle at top right, rgba(7, 17, 13, 0.08), transparent 24%),
        linear-gradient(180deg, #f4f8f4 0%, var(--bg-color) 100%);
    line-height: 1.6;
}

.auth-screen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 20px;
    background:
        radial-gradient(circle at 15% 20%, rgba(39, 194, 122, 0.2), transparent 28%),
        radial-gradient(circle at 82% 14%, rgba(7, 17, 13, 0.26), transparent 22%),
        linear-gradient(135deg, #06120a, #12261c 62%, #09140f);
}

.auth-screen.is-hidden { display: none; }

.auth-card {
    width: min(420px, 100%);
    padding: 32px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
}

.auth-card .logo { color: var(--primary-color); font-size: 1.35rem; font-weight: 700; margin-bottom: 24px; }
.auth-brand { height: 124px; margin: 0 0 18px; display: grid; place-items: center; }
.auth-brand img { display:block; width:min(230px, 100%); height:124px; object-fit:contain; }
.auth-card h1 { margin-bottom: 6px; text-align: center; }
.auth-card > .text-muted { text-align: center; }
.auth-card > .text-muted { margin-bottom: 22px; }
.auth-card .btn { width: 100%; margin-top: 8px; }
.auth-card #auth-error { min-height: 24px; margin-top: 12px; }

.company-create-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 7px;
    font-size: 0.82rem;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2200;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(6, 18, 10, 0.64);
}

.company-quick-create {
    width: min(760px, 100%);
    max-height: 92vh;
}

.app-c.doc-actions {
    display: flex;
    gap: 10px;
}

/* Kanban Board */
.kanban-board {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding: 20px 0;
    min-height: 70vh;
}

.kanban-column {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    min-width: 300px;
    max-width: 350px;
    display: flex;
    flex-direction: column;
}

.kanban-column h3 {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1.1rem;
    color: var(--primary-color);
}

.task-list {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 100px;
}

.task-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 5px solid transparent;
}

.task-card:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.task-card.priority-low { border-left-color: #4cd137; }
.task-card.priority-medium { border-left-color: #fbc531; }
.task-card.priority-high { border-left-color: #e84118; }
.task-card.priority-urgent { border-left-color: #c23616; animation: pulse 2s infinite; }

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(194, 54, 22, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(194, 54, 22, 0); }
    100% { box-shadow: 0 0 0 0 rgba(194, 54, 22, 0); }
}

/* Dashboard Statistics */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    padding: 24px;
    border-radius: var(--radius-lg); /* Assuming --radius-lg is defined elsewhere or needs to be added */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast); /* Assuming --transition-fast is defined */
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: rgba(10, 20, 14, 0.78);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.stat-desc {
    font-size: 0.85rem;
    color: rgba(54, 74, 61, 0.78);
}

.stat-icon {
    position: absolute;
    right: -10px;
    bottom: -10px;
    font-size: 5rem;
    opacity: 0.1;
    transition: transform var(--transition-normal); /* Assuming --transition-normal is defined */
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(-10deg);
}

.bg-gradient-blue { background: linear-gradient(135deg, #06120d, #123322); color: white; }
.bg-gradient-dark { background: linear-gradient(135deg, #030605, #0d1721); color: white; }
.bg-gradient-green { background: linear-gradient(135deg, #0f8f54, #0b5f38); color: white; }
.bg-gradient-purple { background: linear-gradient(135deg, #07130d, #183a28); color: white; }
.bg-gradient-orange { background: linear-gradient(135deg, #102017, #2a4a34); color: white; }

.stat-card.bg-gradient-blue,
.stat-card.bg-gradient-dark,
.stat-card.bg-gradient-green,
.stat-card.bg-gradient-purple,
.stat-card.bg-gradient-orange {
    color: white;
    border-color: rgba(255, 255, 255, 0.08);
}

.stat-card.bg-gradient-blue { background: linear-gradient(135deg, #06120d, #123322); }
.stat-card.bg-gradient-dark { background: linear-gradient(135deg, #030605, #0d1721); }
.stat-card.bg-gradient-green { background: linear-gradient(135deg, #0f8f54, #0b5f38); }
.stat-card.bg-gradient-purple { background: linear-gradient(135deg, #07130d, #183a28); }
.stat-card.bg-gradient-orange { background: linear-gradient(135deg, #102017, #2a4a34); }

.stat-card.bg-gradient-blue h3,
.stat-card.bg-gradient-dark h3,
.stat-card.bg-gradient-green h3,
.stat-card.bg-gradient-purple h3,
.stat-card.bg-gradient-orange h3 {
    color: rgba(255, 255, 255, 0.8);
}

.stat-card.bg-gradient-blue .stat-desc,
.stat-card.bg-gradient-dark .stat-desc,
.stat-card.bg-gradient-green .stat-desc,
.stat-card.bg-gradient-purple .stat-desc,
.stat-card.bg-gradient-orange .stat-desc {
    color: rgba(255, 255, 255, 0.68);
}

/* Section Refinements */
.welcome-section {
    margin-bottom: 40px;
}

.welcome-section h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    background: linear-gradient(to right, var(--primary-color), #06120d);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.task-card h4 {
    margin-bottom: 8px;
    font-size: 1rem;
}

.task-card p {
    font-size: 0.85rem;
    color: #ccc;
    margin-bottom: 12px;
}

.task-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #888;
}

.task-due.overdue {
    color: #e84118;
    font-weight: 600;
}

.task-attachments {
    font-size: 0.75rem;
    color: var(--primary-color);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.document-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    margin-bottom: 12px;
}

.category-pill {
    font-size: 0.7rem;
    background: rgba(255,255,255,0.1);
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-pill {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.status-active { background: rgba(46, 213, 115, 0.2); color: #2ed573; }
.status-warn { background: rgba(255, 71, 87, 0.2); color: #ff4757; }

/* Rent Demand Status */
.status-offen { background: rgba(255, 71, 87, 0.2); color: #ff4757; }
.status-bezahlt { background: rgba(46, 213, 115, 0.2); color: #2ed573; }
.status-teilweise { background: rgba(255, 159, 67, 0.2); color: #ff9f43; }
.status-storniert { background: rgba(149, 165, 166, 0.2); color: #95a5a6; }

/* Utility Colors */
.text-success { color: #10b981 !important; }
.text-danger { color: #ef4444 !important; }
.text-warning { color: #f59e0b !important; }
.text-primary { color: var(--primary-color) !important; }
.text-muted { color: var(--text-muted) !important; }

.doc-financials {
    display: flex;
    gap: 10px;
    align-items: center;
    color: var(--text-secondary); /* Assuming --text-secondary is defined or should be --text-muted */
}

.doc-financials i { font-size: 0.75rem; margin-right: 3px; }

.task-actions {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
    gap: 5px;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

.project-timeline {
    position: relative;
    display: grid;
    gap: 12px;
    padding: 8px 0 8px 24px;
}

.construction-board {
    display: grid;
    gap: 16px;
    width: 100%;
    min-width: 0;
}

.construction-board-header {
    align-items: flex-start;
}

.construction-board-top-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 16px;
}

.construction-board-top-grid .section-heading h3 {
    margin-bottom: 4px;
}

.construction-board-top-grid .section-heading p {
    margin: 0;
}

.construction-board-top-grid .form-row,
.construction-board-top-grid .btn-group {
    flex-wrap: wrap;
}

.construction-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    align-content: start;
}

.accounting-invoice-preview-grid {
    margin: 1rem 0 1.25rem;
}

.construction-preview-card {
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(15, 143, 84, 0.12);
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.construction-preview-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(7, 17, 13, 0.14);
}

.construction-preview-link {
    display: grid;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.construction-preview-media {
    min-height: 140px;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, rgba(15, 143, 84, 0.10), rgba(7, 17, 13, 0.04));
    color: var(--primary-color);
    position: relative;
}

.construction-preview-media img {
    width: 100%;
    height: 100%;
    min-height: 140px;
    object-fit: cover;
    display: block;
}

.construction-preview-pdf {
    width: 100%;
    height: 240px;
    border: 0;
    background: #fff;
}

.construction-preview-media i {
    font-size: 2.5rem;
}

.construction-preview-media span {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(7, 17, 13, 0.72);
    color: #fff;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
}

.construction-preview-body {
    padding: 12px 14px 14px;
    display: grid;
    gap: 4px;
}

.construction-preview-body strong {
    line-height: 1.25;
}

.construction-preview-body small {
    color: var(--text-muted);
}

.construction-dropzone {
    border: 1.5px dashed rgba(15, 143, 84, 0.42);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(15, 143, 84, 0.06), rgba(7, 17, 13, 0.03));
    padding: 18px 16px;
    display: grid;
    gap: 6px;
    justify-items: center;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.construction-dropzone i {
    font-size: 1.6rem;
    color: var(--primary-color);
}

.construction-dropzone strong {
    font-size: 0.95rem;
}

.construction-dropzone span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.construction-dropzone:hover,
.construction-dropzone.is-dragover {
    border-color: var(--primary-color);
    background: linear-gradient(180deg, rgba(15, 143, 84, 0.12), rgba(7, 17, 13, 0.06));
    transform: translateY(-1px);
}

.construction-dropzone.has-file {
    border-style: solid;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.construction-board .stat-card {
    min-height: 130px;
}

.accounting-summary {
    margin-bottom: 18px;
    padding: 12px 16px;
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    background: white;
    color: var(--text-muted);
}

#accounting-view h2 { margin-bottom: 14px; }
#accounting-view td .btn { padding: 6px 10px; margin-right: 6px; }

.project-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 12px;
    bottom: 12px;
    width: 2px;
    background: var(--primary-color);
}

.timeline-entry {
    position: relative;
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 2px 14px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #f8fafc;
}

.timeline-entry::before {
    content: '';
    position: absolute;
    left: -22px;
    top: 18px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary-color);
}

.timeline-entry time { color: var(--text-muted); font-size: .85rem; }
.timeline-entry small { grid-column: 2; color: var(--text-muted); }

.pulse-row {
    animation: pulse-row 1.4s ease-in-out;
    outline: 2px solid rgba(34, 197, 94, 0.5);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.08);
}

@keyframes pulse-row {
    0% { transform: scale(1); }
    20% { transform: scale(1.01); }
    100% { transform: scale(1); }
}

/* Sidebar */
.sidebar {
    width: 260px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.04), transparent 12%),
        linear-gradient(180deg, #07110d 0%, #0a1712 100%);
    color: white;
    padding: 2rem 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    box-shadow: 12px 0 40px rgba(7, 17, 13, 0.22);
}

.sidebar .logo {
    padding: 0 2rem;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
}

.sidebar .logo i {
    color: var(--primary-color);
}

.sidebar .logo-brand {
    height: 76px;
    margin: 0 1rem 2.1rem;
    padding: 0;
    display: grid;
    place-items: center;
}

.sidebar .logo-brand img {
    display: block;
    width: 68px;
    height: 68px;
    object-fit: contain;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.28));
}

.sidebar nav ul {
    list-style: none;
}

.sidebar nav li {
    padding: 1.2rem 2rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    gap: 15px;
    color: rgba(255, 255, 255, 0.7);
    border-left: 4px solid transparent;
}

.sidebar nav li:hover {
    color: white;
    background: rgba(39, 194, 122, 0.12);
}

.sidebar nav li.active {
    color: white;
    background: linear-gradient(90deg, rgba(39, 194, 122, 0.2), rgba(39, 194, 122, 0.06));
    border-left: 4px solid var(--primary-color);
}

.sidebar nav li i {
    width: 20px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 2rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Main Content */
/* Contacts Split View */
.contacts-sections {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.contact-section h3 {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.contact-section {
    padding: 20px;
}

.company-contact-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.company-contact-chip {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.45rem 0.7rem;
    border-radius: 0.75rem;
    background: rgba(39, 194, 122, 0.08);
    border: 1px solid rgba(39, 194, 122, 0.18);
    min-width: 140px;
}

.company-contact-chip strong {
    font-size: 0.92rem;
}

.company-contact-chip small {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.main-content {
    flex: 1;
    padding: 1.5rem 2rem 2rem;
    overflow-y: auto;
    min-width: 0;
    background:
        radial-gradient(circle at 50% 0, rgba(255,255,255,0.75), transparent 30%),
        linear-gradient(180deg, rgba(255,255,255,0.5), transparent 100%);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.25rem;
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 0.75rem 0 1rem;
    backdrop-filter: blur(10px);
}

.search-bar {
    position: relative;
    width: 400px;
}

.search-bar i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-bar input {
    width: 100%;
    padding: 12px 12px 12px 45px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255,255,255,0.94);
    outline: none;
    transition: box-shadow 0.3s;
    box-shadow: 0 10px 24px rgba(10, 20, 14, 0.05);
}

.search-bar input:focus {
    box-shadow: 0 0 0 4px rgba(15, 143, 84, 0.12);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 20px;
}

.quick-capture-button { margin-left: auto; margin-right: 18px; }
.quick-capture-dialog { max-width: 760px; }
.quick-capture-grid { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:12px; }
.quick-capture-grid button { text-align:left; display:grid; grid-template-columns:38px 1fr; column-gap:12px; align-items:center; min-height:92px; padding:16px; border:1px solid #dce9e1; border-radius:12px; background:#fff; color:var(--text-primary); cursor:pointer; transition:transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.quick-capture-grid button:hover { transform:translateY(-2px); border-color:var(--primary-color); box-shadow:0 8px 20px rgba(15,143,84,.13); }
.quick-capture-grid i { grid-row:span 2; color:var(--primary-color); font-size:1.35rem; text-align:center; }
.quick-capture-grid strong { display:block; }
.quick-capture-grid span { color:var(--text-muted); font-size:.86rem; line-height:1.35; }

.invoice-workflow { display:flex; gap:0; margin:0 0 18px; overflow-x:auto; padding:2px; }
.invoice-workflow-step { min-width:108px; flex:1; display:flex; align-items:center; gap:7px; padding:8px 10px; color:var(--text-muted); border-bottom:3px solid #d9e2dd; font-size:.8rem; white-space:nowrap; }
.invoice-workflow-step span { width:22px; height:22px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; background:#e8eeea; font-weight:700; }
.invoice-workflow-step.is-complete { color:#0f7b48; border-color:#69bf91; }
.invoice-workflow-step.is-complete span { background:#16975b; color:#fff; }
.invoice-workflow-step.is-active { color:#073b27; border-color:var(--primary-color); }
.invoice-workflow-step.is-active span { background:var(--primary-color); color:#fff; }

.form-optional-section { margin:4px 0 14px; border:1px solid #e2e9e5; border-radius:10px; padding:0 12px; background:#fbfdfb; }
.form-optional-section summary { cursor:pointer; padding:11px 0; font-weight:650; color:var(--text-primary); }
.form-optional-section summary span { color:var(--text-muted); font-weight:400; }
.form-optional-section .form-group { padding-bottom:6px; }
.invoice-checklist { display:grid; gap:6px; margin:14px 0; }
.invoice-checklist span { color:var(--text-muted); font-size:.9rem; }
.invoice-checklist ul { display:flex; flex-wrap:wrap; gap:6px 12px; list-style:none; margin:0; padding:0; }
.invoice-checklist li { color:#a45b0b; font-size:.82rem; }
.invoice-checklist li.is-complete { color:#087d47; }
.invoice-checklist li i { margin-right:4px; }
.defect-journal { display:grid; gap:10px; margin-top:16px; }
.defect-comment-list { display:grid; gap:8px; max-height:260px; overflow:auto; }

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #ef4444;
}

.status-indicator.online {
    background-color: #10b981;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-color), #156b44);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

#view-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

#view-title h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.96), rgba(249,251,249,0.96));
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
    border: 1px solid rgba(15, 143, 84, 0.08);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: rgba(15, 143, 84, 0.1);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.stat-info h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.stat-info p {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Tables */
.content-table {
    background: rgba(255,255,255,0.9);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(15, 143, 84, 0.08);
    min-width: 0;
}

.content-view {
    min-width: 0;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.9fr;
    gap: 1.25rem;
}

.settings-card {
    display: grid;
    gap: 1rem;
    align-content: start;
}

.settings-card h3,
.settings-card h4 {
    margin: 0;
}

.settings-note {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(15, 143, 84, 0.08);
    border: 1px solid rgba(15, 143, 84, 0.14);
    color: var(--text-secondary);
}

.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-container table {
    min-width: 100%;
}

.table-header {
    margin-bottom: 1.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

.form-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.form-row > .form-group {
    flex: 1 1 0;
    min-width: 220px;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-group .btn {
    flex: 0 0 auto;
}

th {
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
}

td {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.btn {
    padding: 10px 20px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #127247);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0d7a49, #0b5f38);
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(15, 143, 84, 0.24);
}

/* Modal and Glassmorphism */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    align-items: center;
    justify-content: center;
}

body.modal-open {
    overflow: hidden;
}

body.modal-open .main-content {
    overflow: hidden !important;
}

.modal-content {
    background: rgba(255, 255, 255, 0.97);
    padding: 2.5rem;
    width: 95%;
    max-width: 700px;
    max-height: 92vh;
    overflow-y: auto;
    border-radius: 24px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.close {
    float: right;
    font-size: 1.5rem;
    cursor: pointer;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    outline: none;
    background: rgba(255,255,255,0.95);
}
/* Badges */
.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.planning { background: #fee2e2; color: #ef4444; }
.badge.under-construction { background: #fef3c7; color: #f59e0b; }
.badge.operational { background: #dcfce7; color: #10b981; }

/* View Switching */
.content-view {
    animation: fadeIn 0.4s ease-out;
    padding-bottom: 1rem;
    min-width: 0;
    width: 100%;
}

.view {
    min-width: 0;
    width: 100%;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header & Actions */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
}

.view-header h1 {
    font-size: 2rem;
    font-weight: 700;
}

/* Documents Grid */
.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.document-card {
    background: rgba(255,255,255,0.92);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.3s;
    border: 1px solid rgba(15, 143, 84, 0.08);
}

.document-card:hover {
    transform: translateY(-5px);
}

.document-card i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Icons */
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.3s;
    font-size: 1rem;
}

.btn-icon:hover {
    color: var(--primary-color);
}

/* Modal Enhancements */
.modal-content h2 {
    margin-bottom: 1.5rem;
}
/* Timeline Styles */
.timeline {
    position: relative;
    padding: 20px 0;
    list-style: none;
}

.timeline:before {
    content: " ";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 20px;
    width: 2px;
    background-color: rgba(255, 255, 255, 0.1);
}

.timeline-item {
    margin-bottom: 25px;
    position: relative;
    padding-left: 50px;
}

.timeline-badge {
    color: #fff;
    width: 34px;
    height: 34px;
    line-height: 34px;
    font-size: 1rem;
    text-align: center;
    position: absolute;
    top: 0;
    left: 4px;
    border-radius: 50%;
    z-index: 10;
}

.timeline-panel {
    width: 100%;
    padding: 15px;
    border-radius: 12px;
    position: relative;
}

.timeline-title {
    margin-top: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.timeline-item.importance-high .timeline-panel {
    border-left: 4px solid #ff4757;
}

.timeline-body p {
    margin-top: 10px;
    font-size: 0.9rem;
    opacity: 0.9;
}
/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transform: translateY(100px);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55), opacity 0.3s;
    opacity: 0;
    z-index: 9999;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-info { background: var(--primary-color); }
.toast-error { background: #e84118; }
.toast-success { background: #4cd137; }
.toast-warning { background: #fbc531; color: #000; }

.object-structure-tree {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.object-structure-node {
    padding: 14px;
    border: 1px solid rgba(15, 143, 84, 0.18);
    border-left: 4px solid var(--primary-color, #0f8f54);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.72);
}

.object-structure-title { display:flex; align-items:center; gap:9px; flex-wrap:wrap; }
.object-structure-title span { color: var(--text-muted, #6b7280); font-size: .9rem; }
.object-structure-node ul { margin: 10px 0 0 20px; padding-left: 16px; display:grid; gap:7px; }
.link-button { border:0; background:transparent; color:var(--primary-color, #0f8f54); padding:0; font:inherit; cursor:pointer; text-align:left; }
.link-button:hover { text-decoration:underline; }

.inline-status-select {
    width: 100%;
    min-width: 125px;
    padding: .38rem .5rem;
    border: 1px solid rgba(15, 143, 84, .28);
    border-radius: 7px;
    background: #fff;
    color: var(--text-color, #172033);
    font-size: .82rem;
    font-weight: 600;
}

.search-bar { position: relative; }
.global-search-results { position:absolute; top:calc(100% + 8px); left:0; width:min(560px, 92vw); max-height:420px; overflow:auto; z-index:1000; padding:8px; border:1px solid rgba(15,143,84,.2); border-radius:12px; background:#fff; box-shadow:0 14px 34px rgba(0,0,0,.16); }
.global-search-results button { display:grid; width:100%; gap:3px; padding:10px; border:0; border-radius:8px; background:transparent; text-align:left; cursor:pointer; }
.global-search-results button:hover { background:rgba(15,143,84,.08); }
.global-search-results small { color:#667085; }
.construction-dashboard { margin-bottom:24px; }
.construction-dashboard-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; margin-bottom:16px; }
.dashboard-action-card { padding:16px; border-radius:14px; background:#fff; border:1px solid rgba(15,143,84,.15); box-shadow:0 6px 20px rgba(18,43,32,.06); }
.dashboard-action-card.is-warning { border-left:4px solid #e1a400; }
.dashboard-action-card.is-alert { border-left:4px solid #d14343; }
.dashboard-action-card h3 { font-size:.95rem; margin:0 0 10px; }
.dashboard-action-card > strong { font-size:2rem; display:block; }
.dashboard-action-card p { min-height:40px; color:#667085; font-size:.88rem; }
.construction-dashboard-columns { display:grid; grid-template-columns:1.35fr 1fr; gap:16px; margin-bottom:22px; }
.construction-dashboard-columns .card { padding:18px; }
.quality-hint { margin:.65rem 0; padding:.65rem .75rem; border-radius:8px; background:#f7f8f7; }
.quality-hint.warning { background:#fff6e6; color:#8b5b00; }
.quality-hint.ok { background:#eaf8ef; color:#137a42; }
.offer-compare-overlay { position:fixed; inset:0; z-index:3000; display:grid; place-items:center; padding:20px; background:rgba(8,20,15,.58); }
.offer-compare-dialog { position:relative; width:min(920px,100%); max-height:85vh; overflow:auto; padding:28px; border-radius:18px; background:#fff; box-shadow:0 25px 70px rgba(0,0,0,.3); }
.offer-compare-close { position:absolute; right:14px; top:14px; }
.template-task-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin-top:16px; }
.budget-context-row td { background:rgba(15,143,84,.055); }
.budget-context { display:grid; gap:8px; padding:6px 10px; }
.budget-context > span { color:#56616e; font-size:.9rem; }
.budget-workflow { display:flex; flex-wrap:wrap; align-items:center; gap:4px; margin-top:7px; font-size:.72rem; color:#819087; }
.budget-workflow span { display:inline-flex; align-items:center; gap:3px; }
.budget-workflow span.is-complete { color:#087d47; font-weight:600; }
.budget-workflow b { color:#b3c1b9; font-weight:500; }
.construction-board-header { position:sticky; top:0; z-index:20; padding:12px 0; background:linear-gradient(180deg,#f4f8f5 75%,rgba(244,248,245,0)); }

@media (max-width: 1100px) {
    .construction-board {
        min-width: 0;
    }

    .construction-board-top-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 960px) {
    .app-container {
        flex-direction: row;
        align-items: stretch;
    }

    .sidebar {
        width: 68px;
        min-width: 68px;
        height: 100vh;
        min-height: 100vh;
        position: sticky;
        top: 0;
        z-index: 20;
        padding: 0.85rem 0 0.5rem;
        box-shadow: 8px 0 24px rgba(7, 17, 13, 0.14);
        overflow-y: auto;
    }

    .sidebar .logo {
        margin-bottom: 1.25rem;
        padding: 0;
        justify-content: center;
        font-size: 0;
    }

    .sidebar .logo i { font-size: 1.45rem; }
    .sidebar .logo-brand {
        height: 48px;
        margin: 0 10px 18px;
        padding: 0;
    }

    .sidebar .logo-brand img {
        width: 42px;
        height: 42px;
    }

    .sidebar nav ul {
        display: block;
        padding: 0;
    }

    .sidebar nav li {
        display: flex;
        justify-content: center;
        padding: 0.9rem 0;
        border-left: 3px solid transparent;
        border-bottom: 0;
        border-radius: 0;
        font-size: 0;
        background: transparent;
    }

    .sidebar nav li i { width: auto; font-size: 1.1rem; }

    .sidebar nav li.active {
        border-left: 3px solid var(--primary-color);
        border-bottom: 0;
        background: rgba(39, 194, 122, 0.16);
    }

    .sidebar-footer {
        display: none;
    }

    .main-content {
        min-width: 0;
        padding: 1rem;
    }

    header,
    #view-title,
    .view-header,
    .construction-board-header,
    .construction-board-top-grid,
    .detail-container,
    .dashboard-charts {
        grid-template-columns: 1fr !important;
    }

    header,
    #view-title,
    .view-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
    }

    .search-bar {
        width: 100%;
    }

    .user-profile {
        justify-content: space-between;
        gap: 10px;
        flex-wrap: wrap;
    }

    .quick-capture-button { margin:0; width:100%; justify-content:center; }
    .quick-capture-grid { grid-template-columns:1fr; }
    .invoice-workflow-step { min-width:96px; padding:7px; font-size:.74rem; }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 1rem;
    }

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

    .content-table,
    .modal-content {
        border-radius: 18px;
    }

    .modal-content {
        width: calc(100% - 1rem);
        padding: 1.25rem;
        max-height: 94vh;
    }

    .btn-group .btn {
        flex: 1 1 180px;
        justify-content: center;
    }

    .project-timeline {
        padding-left: 18px;
    }

    .timeline-entry {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .timeline-entry small {
        grid-column: 1;
    }
}

@media (max-width: 760px) {
    .construction-dashboard-grid,
    .construction-dashboard-columns,
    .template-task-list { grid-template-columns:1fr; }
    .mobile-quick-actions { width:100%; }
    .mobile-quick-actions .btn { flex:1; }
    .global-search-results { left:auto; right:0; width:calc(100vw - 28px); }
    .construction-board-header .btn-group,
    .construction-board-top-grid .btn-group {
        width: 100%;
    }

    .construction-board-header .btn-group .btn,
    .construction-board-top-grid .btn-group .btn {
        width: 100%;
    }

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

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

    .form-row {
        flex-direction: column;
    }

    .form-row > .form-group {
        min-width: 0;
    }

    th,
    td {
        padding: 0.75rem 0.65rem;
        font-size: 0.86rem;
    }

    table {
        min-width: 720px;
    }

    .content-table {
        padding: 1rem;
    }

    .modal-content {
        width: calc(100% - 0.75rem);
        padding: 1rem;
    }

    .sidebar nav li { padding: 0.8rem 0; }
}
