/* ============================================================
   style.css — Briarcliffe Holdings Owner Portal
   ============================================================ */

/* ---------- Google Fonts ---------- */
@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Public+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap");

/* ---------- Design tokens ---------- */
:root {
    --charcoal: #1e2430;
    --canvas: #f4f6f8;
    --surface: #ffffff;
    --slate: #344b68;
    --navy: #243550;
    --navy-deep: #1a2d42;
    --steel: #5b7a9d;
    --steel-dark: #3d5670;
    --border: #d4d9e0;
    --border-soft: #e8ecf0;
    --muted: #5e6470;
    --cerulean: #4a7c9b;
    --warn: #a9551f;
    --bad: #9b3a2e;
    --shadow-sm:
        0 1px 2px rgba(30, 36, 48, 0.05), 0 4px 12px rgba(30, 36, 48, 0.06);
    --shadow:
        0 1px 2px rgba(30, 36, 48, 0.05), 0 8px 28px rgba(30, 36, 48, 0.08);
    --shadow-lg:
        0 2px 4px rgba(30, 36, 48, 0.06), 0 16px 48px rgba(30, 36, 48, 0.12);
    --serif: "Fraunces", Georgia, "Times New Roman", serif;
    --sans: "Public Sans", -apple-system, "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", "SF Mono", Consolas, monospace;
    --sidebar-w: 240px;
    --header-h: 64px;
    --radius: 6px;
    --radius-sm: 3px;
    --transition: 0.18s ease;
}

/* ---------- Reset ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html {
    scroll-behavior: smooth;
    font-size: 16px;
}
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}
body {
    font-family: var(--sans);
    background: var(--canvas);
    color: var(--charcoal);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}
img {
    max-width: 100%;
    display: block;
}
a {
    color: var(--steel-dark);
}
:focus-visible {
    outline: 2px solid var(--steel);
    outline-offset: 2px;
    border-radius: 2px;
}
button {
    font-family: inherit;
    cursor: pointer;
}
h1, h2, h3 {
    font-family: var(--serif);
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

/* ---------- Utilities ---------- */
.hidden {
    display: none !important;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

/* ---------- Shared buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--slate);
    background: var(--slate);
    color: #fff;
    padding: 9px 20px;
    font-size: 0.86rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-decoration: none;
    cursor: pointer;
    transition:
        background var(--transition),
        border-color var(--transition),
        box-shadow var(--transition);
}
.btn:hover {
    background: var(--navy);
    border-color: var(--navy);
}
.btn.ghost {
    background: transparent;
    color: var(--slate);
    border-color: var(--slate);
}
.btn.ghost:hover {
    background: var(--slate);
    color: #fff;
}
.btn.steel {
    background: var(--steel-dark);
    border-color: var(--steel-dark);
}
.btn.steel:hover {
    background: #2f4560;
    border-color: #2f4560;
}
.btn.small {
    padding: 6px 14px;
    font-size: 0.8rem;
}
.btn.danger {
    background: transparent;
    border-color: var(--bad);
    color: var(--bad);
}
.btn.danger:hover {
    background: var(--bad);
    color: #fff;
}
.btn.icon-btn {
    padding: 7px 10px;
}

/* ---------- Login screen ---------- */
#loginScreen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: var(--canvas);
    background-image:
        radial-gradient(
            ellipse 80% 60% at 60% 0%,
            rgba(52, 75, 104, 0.06) 0%,
            transparent 70%
        ),
        radial-gradient(
        ellipse 50% 40% at 0% 100%,
        rgba(91, 122, 157, 0.05) 0%,
        transparent 60%
    );
}
.login-card {
    width: min(440px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 44px 40px;
    box-shadow: var(--shadow-lg);
}
.login-brand {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-soft);
}
.login-brand .mark {
    font-family: var(--serif);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--charcoal);
}
.login-brand .mark em {
    font-style: italic;
    color: var(--steel-dark);
}
.login-brand .est {
    font-family: var(--mono);
    font-size: 0.6rem;
    letter-spacing: 0.14em;
    color: var(--muted);
    text-transform: uppercase;
}
.login-card .eyebrow {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--steel-dark);
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin-bottom: 10px;
}
.login-card .eyebrow::before {
    content: "";
    width: 22px;
    height: 1px;
    background: var(--steel);
}
.login-card h1 {
    font-size: 1.7rem;
    margin-bottom: 6px;
}
.login-card .sub {
    font-size: 0.88rem;
    color: var(--muted);
    margin-bottom: 28px;
}
.field {
    margin-bottom: 18px;
}
.field label {
    display: block;
    font-size: 0.77rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 7px;
}
.field input, .field select, .field textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.92rem;
    background: #fff;
    color: var(--charcoal);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--steel);
    box-shadow: 0 0 0 3px rgba(91, 122, 157, 0.15);
}
.login-err {
    color: var(--bad);
    font-size: 0.84rem;
    margin: -6px 0 14px;
    min-height: 1.2em;
    display: flex;
    align-items: center;
    gap: 6px;
}
.login-err:not(:empty)::before {
    content: "⚠";
}
.demo-note {
    margin-top: 20px;
    padding: 12px 14px;
    background: var(--canvas);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--muted);
    line-height: 1.8;
}
.demo-note b {
    color: var(--charcoal);
}

/* ---------- App shell ---------- */
#appShell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--header-h) 1fr;
    min-height: 100vh;
}

/* ---------- Top header bar ---------- */
.app-header {
    grid-column: 1 / -1;
    background: rgba(244, 246, 248, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px 0 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-brand {
    display: flex;
    align-items: center;
    gap: 0;
    width: var(--sidebar-w);
    padding: 0 20px;
    height: 100%;
    border-right: 1px solid var(--border);
    text-decoration: none;
    color: var(--charcoal);
}
.header-brand .mark {
    font-family: var(--serif);
    font-size: 1.1rem;
    font-weight: 600;
}
.header-brand .mark em {
    font-style: italic;
    color: var(--steel-dark);
}
.header-meta {
    display: flex;
    align-items: center;
    gap: 20px;
}
.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
}
.header-user .avatar-sm {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--slate);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--serif);
    font-size: 0.95rem;
    font-weight: 500;
    flex-shrink: 0;
}
.header-user .name {
    font-size: 0.88rem;
    font-weight: 600;
}
.header-user .role {
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--steel-dark);
}

/* ---------- Sidebar ---------- */
.sidebar {
    background: var(--navy-deep);
    background: linear-gradient(
        180deg,
        var(--navy) 0%,
        var(--navy-deep) 100%
    );
    color: #c8d4e0;
    padding: 20px 0 24px;
    position: sticky;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.sidebar nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 10px;
}
.nav-section-label {
    font-family: var(--mono);
    font-size: 0.6rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.3);
    padding: 18px 12px 6px;
}
.nav-btn {
    appearance: none;
    background: none;
    border: none;
    text-align: left;
    color: #a8b4c4;
    padding: 10px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background var(--transition), color var(--transition);
    cursor: pointer;
    width: 100%;
}
.nav-btn .nav-icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
    flex-shrink: 0;
}
.nav-btn:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
}
.nav-btn[aria-current="true"] {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--steel);
}
.nav-btn[aria-current="true"] .nav-icon {
    opacity: 1;
}
.sidebar-footer {
    padding: 16px 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 16px;
}

/* ---------- Main content area ---------- */
.main-content {
    padding: 36px 44px;
    min-width: 0;
    overflow-x: hidden;
}
.page-head {
    margin-bottom: 28px;
}
.page-head h2 {
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    margin-bottom: 6px;
}
.page-head .pg-sub {
    color: var(--muted);
    font-size: 0.9rem;
    max-width: 80ch;
}

/* ---------- KPI cards ---------- */
.kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
}
.kpi:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.kpi .kpi-label {
    font-family: var(--mono);
    font-size: 0.64rem;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--muted);
    display: block;
    margin-bottom: 7px;
}
.kpi .kpi-val {
    font-family: var(--serif);
    font-size: 1.6rem;
    font-weight: 500;
    display: block;
    line-height: 1.1;
}
.kpi .kpi-sub {
    display: block;
    font-size: 0.76rem;
    color: var(--muted);
    margin-top: 4px;
}
.kpi.good .kpi-val {
    color: var(--cerulean);
}
.kpi.warn .kpi-val {
    color: var(--warn);
}

/* ---------- Section headings ---------- */
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    margin: 32px 0 14px;
    flex-wrap: wrap;
}
.section-head h3 {
    font-size: 1.18rem;
}

/* ---------- Tags & pills ---------- */
.tag {
    font-family: var(--mono);
    font-size: 0.63rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    color: var(--muted);
    background: var(--canvas);
    white-space: nowrap;
}
.tag.sf {
    color: #5a6e8c;
    border-color: #b9c4d4;
    background: #f0f3f8;
}
.tag.mf {
    color: #4a6080;
    border-color: #b9c4d4;
    background: #eef2f6;
}
.tag.com {
    color: #5c4e73;
    border-color: #cdc2dd;
    background: #f5f2fa;
}

.pill {
    font-family: var(--mono);
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 99px;
    border: 1px solid;
    white-space: nowrap;
}
.pill.open {
    color: var(--cerulean);
    border-color: var(--cerulean);
    background: #e8f0f6;
}
.pill.leased {
    color: var(--muted);
    border-color: var(--border);
    background: var(--canvas);
}

/* ---------- Data tables ---------- */
.tbl-scroll {
    overflow-x: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
table.data {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 0.86rem;
}
table.data caption {
    text-align: left;
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0 0 10px;
}
table.data th {
    font-family: var(--mono);
    font-size: 0.64rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 500;
    text-align: left;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--canvas);
    white-space: nowrap;
}
table.data td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: top;
}
table.data tr:last-child td {
    border-bottom: none;
}
table.data td.num, table.data th.num {
    text-align: right;
    font-family: var(--mono);
    font-size: 0.82rem;
    white-space: nowrap;
}
table.data tr.total td {
    border-top: 2px solid var(--charcoal);
    font-weight: 600;
    background: var(--canvas);
}
table.data tbody tr:hover td {
    background: rgba(91, 122, 157, 0.06);
}

/* ---------- Inline table editing (time log) ---------- */
table.data input,
table.data select,
table.data textarea {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    font: inherit;
    font-size: 0.84rem;
    padding: 4px 6px;
    border-radius: 3px;
    color: var(--charcoal);
    transition: border-color var(--transition), background var(--transition);
}
table.data textarea {
    resize: vertical;
    min-height: 36px;
    font-size: 0.82rem;
}
table.data input:hover,
table.data select:hover,
table.data textarea:hover {
    border-color: var(--border);
}
table.data input:focus,
table.data select:focus,
table.data textarea:focus {
    border-color: var(--steel);
    outline: 1px solid var(--steel);
    background: #fff;
}
table.data input.hrs {
    font-family: var(--mono);
    text-align: right;
    width: 64px;
}
table.data input.tm {
    font-family: var(--mono);
    width: 88px;
}
table.data input.dt {
    font-family: var(--mono);
    width: 130px;
}
table.data tr:not([data-editing="true"]) input:disabled,
table.data tr:not([data-editing="true"]) select:disabled,
table.data tr:not([data-editing="true"]) textarea:disabled {
    color: var(--charcoal);
    opacity: 1;
    cursor: default;
}
.row-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 72px;
}
.row-actions .btn {
    width: 100%;
    justify-content: center;
}
.del-row {
    appearance: none;
    border: none;
    background: none;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1;
    padding: 5px 7px;
    border-radius: 3px;
    transition: color var(--transition), background var(--transition);
}
.del-row:hover {
    color: var(--bad);
    background: rgba(155, 58, 46, 0.08);
}
#toast.ok {
    background: var(--navy);
}
#toast.err {
    background: var(--bad);
}

/* ---------- Linkish button ---------- */
.linkish {
    appearance: none;
    background: none;
    border: none;
    color: var(--steel-dark);
    font-weight: 600;
    font-size: 0.86rem;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    transition: color var(--transition);
}
.linkish:hover {
    color: var(--navy);
}
.back-btn {
    margin-bottom: 20px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* ---------- Standing ---------- */
.standing {
    font-weight: 600;
}
.standing.good {
    color: var(--cerulean);
}
.standing.warn {
    color: var(--warn);
}

/* ---------- Time log toolbar ---------- */
.log-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.prop-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px 20px;
    margin-bottom: 28px;
}
.prop-form .section-head {
    align-items: center;
}
.finance-grid td.muted,
.finance-grid .muted {
    color: var(--muted);
    font-style: italic;
}
.finance-grid td.num {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
#propCashFlow,
#propTaxable {
    margin-bottom: 1.5rem;
}
.prop-form input[readonly] {
    background: var(--border-soft);
    opacity: 0.85;
}
.log-toolbar .spacer {
    flex: 1;
}

/* ---------- Progress meter ---------- */
.meter {
    height: 7px;
    background: var(--border-soft);
    border-radius: 99px;
    overflow: hidden;
    margin-top: 10px;
}
.meter i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--steel) 0%, var(--steel-dark) 100%);
    border-radius: 99px;
    transition: width 0.6s ease;
}

/* ---------- Compliance callout ---------- */
.compliance {
    margin-top: 28px;
    background: #eef2f6;
    border: 1px solid var(--border);
    border-left: 3px solid var(--steel);
    border-radius: var(--radius-sm);
    padding: 18px 22px;
    font-size: 0.86rem;
    color: #4a5568;
    line-height: 1.7;
}
.compliance b {
    color: var(--charcoal);
}
.compliance ul {
    margin: 8px 0 0 20px;
}
.compliance li {
    margin-bottom: 5px;
}

/* ---------- Dashboard property list ---------- */
.prop-row-img {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
    margin-right: 10px;
}

/* ---------- Empty state ---------- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}
.empty-state p {
    font-size: 0.95rem;
}

/* ---------- Notification toast ---------- */
#toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    background: var(--navy);
    color: #fff;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    z-index: 999;
    max-width: 320px;
}
#toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    :root {
        --sidebar-w: 200px;
    }
    .main-content {
        padding: 24px 20px;
    }
}
@media (max-width: 680px) {
    #appShell {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: static;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 8px 10px;
        align-items: center;
    }
    .sidebar nav {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0;
    }
    .nav-section-label {
        display: none;
    }
    .nav-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    .nav-btn[aria-current="true"] {
        box-shadow: none;
        border-bottom: 2px solid var(--steel);
        border-radius: 0;
    }
    .sidebar-footer {
        margin-top: 0;
        border-top: none;
        padding: 0 0 0 auto;
        margin-left: auto;
    }
    .header-brand {
        width: auto;
        border-right: none;
    }
}
