/* Shared look for the three Strata portals. Each portal sets --accent via a .portal-* class on <body> (web) or a wrapper (tablet app). */
:root {
    --accent: #2f5fb3;
    --bg: #f5f6f8;
    --surface: #ffffff;
    --text: #1d2330;
    --muted: #667085;
    --border: #e3e6ec;
    --danger: #b42318;
    --radius: 10px;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
}

body { margin: 0; }
.portal-admin { --accent: #6941c6; }
.portal-strata { --accent: #2f5fb3; }
.portal-tenant { --accent: #0e7c66; }

h1 { font-size: 1.35rem; margin: 0 0 .75rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
a { color: var(--accent); }

.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .75rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; letter-spacing: .02em; }
.brand .portal { font-weight: 500; color: var(--accent); margin-left: .35rem; }
.who { display: flex; align-items: center; gap: .6rem; font-size: .9rem; }

.content { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }
.grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 800px) { .grid { grid-template-columns: 1fr; } }

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.25rem; margin-bottom: 1.25rem;
}
.card.login { max-width: 420px; margin: 3rem auto; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--danger); margin: .5rem 0; }
.notice { color: #067647; margin: .5rem 0; }

label { display: block; font-size: .9rem; font-weight: 500; margin-bottom: .75rem; }
input, select, textarea {
    display: block; width: 100%; box-sizing: border-box; margin-top: .3rem;
    padding: .5rem .6rem; font: inherit; border: 1px solid var(--border); border-radius: 6px; background: #fff;
}
textarea { min-height: 6rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
select.inline { display: inline-block; width: auto; margin: 0; padding: .3rem .4rem; }
.validation-message { color: var(--danger); font-size: .85rem; margin: -.5rem 0 .75rem; }

.btn {
    display: inline-block; padding: .5rem 1rem; border: 0; border-radius: 6px; cursor: pointer;
    background: var(--accent); color: #fff; font: inherit; font-weight: 600;
}
.btn.small { padding: .3rem .7rem; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-link { border: 0; background: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
    border: 1px solid var(--border); background: var(--bg); border-radius: 999px;
    padding: .3rem .75rem; font: inherit; font-size: .85rem; cursor: pointer;
}
.chip:hover { border-color: var(--accent); }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
th, td { padding: .55rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td .desc { color: var(--muted); font-size: .85rem; margin-top: .2rem; white-space: pre-line; }
.nowrap { white-space: nowrap; }

.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.status-open { background: #fef0c7; color: #93370d; }
.status-in-progress { background: #d1e9ff; color: #1849a9; }
.status-resolved { background: #d1fadf; color: #05603a; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list a { display: block; padding: .75rem .25rem; text-decoration: none; color: inherit; }
.list a:hover strong { color: var(--accent); }
.back { display: inline-block; margin-bottom: 1rem; font-size: .9rem; }
.status-edit { display: flex; gap: .4rem; align-items: center; }

/* ---- Priority badges ---- */
.prio-low { background: #f2f4f7; color: #475467; }
.prio-medium { background: #e0eaff; color: #3538cd; }
.prio-high { background: #fedf89; color: #93370d; }
.prio-urgent { background: #fee4e2; color: #b42318; }

/* ---- Portal navigation ---- */
.subnav { display: flex; gap: .25rem; align-items: center; margin-bottom: 1.25rem; flex-wrap: wrap; }
.subnav a {
    padding: .45rem .9rem; border-radius: 6px; text-decoration: none; color: var(--text); font-weight: 500;
}
.subnav a:hover { background: var(--surface); }
.subnav a.active { background: var(--surface); color: var(--accent); box-shadow: inset 0 0 0 1px var(--border); }
.subnav .spacer { flex: 1; }
.subnav a.btn, .subnav a.btn:hover { color: #fff; background: var(--accent); }
.role-badge { background: var(--surface); color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); }
a.btn { text-decoration: none; }
.btn.secondary { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.btn.danger-outline { background: var(--surface); color: var(--danger); box-shadow: inset 0 0 0 1px #fda29b; }

/* ---- Page heading ---- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.page-head h1 { margin-bottom: .2rem; }
.meta { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; font-size: .9rem; }

/* ---- Stat tiles ---- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
@media (max-width: 800px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat {
    display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1rem 1.1rem; text-decoration: none; color: inherit;
}
.stat:hover { border-color: var(--accent); }
.stat .value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.stat .label { color: var(--muted); font-size: .85rem; margin-top: .2rem; }
.stat.open .value { color: #b54708; }
.stat.in-progress .value { color: #1849a9; }
.stat.resolved .value { color: #067647; }

/* ---- Forms ---- */
.form-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 800px) { .form-row { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: .5rem; margin-top: .5rem; }
.hint { color: var(--muted); font-size: .82rem; font-weight: 400; }
.filters { display: flex; gap: .75rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.filters label { margin: 0; min-width: 9rem; }
.filters label.grow { flex: 1; min-width: 12rem; }

/* ---- Photos ---- */
.photos { display: flex; flex-wrap: wrap; gap: .6rem; }
.photo-thumb {
    position: relative; width: 120px; height: 120px; padding: 0; border: 1px solid var(--border);
    border-radius: 8px; overflow: hidden; background: var(--bg); cursor: zoom-in;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos.compact .photo-thumb { width: 52px; height: 52px; }
.photo-remove {
    position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0;
    background: rgba(16, 24, 40, .7); color: #fff; cursor: pointer; font-size: .9rem; line-height: 1;
}
.photo-picker {
    display: flex; align-items: center; justify-content: center; flex-direction: column; gap: .2rem;
    width: 120px; height: 120px; border: 2px dashed var(--border); border-radius: 8px; cursor: pointer;
    color: var(--muted); font-size: .85rem; text-align: center; margin: 0;
}
.photo-picker:hover { border-color: var(--accent); color: var(--accent); }
.photo-picker input { display: none; }
.photo-picker .plus { font-size: 1.6rem; line-height: 1; }
.uploading { opacity: .6; }
.lightbox {
    position: fixed; inset: 0; background: rgba(16, 24, 40, .85); z-index: 50;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; cursor: zoom-out;
}
.lightbox img { max-width: 92vw; max-height: 82vh; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.lightbox-bar { display: flex; gap: 1rem; align-items: center; cursor: default; }
.lightbox-bar a { color: #fff; }

/* ---- Complaint list rows ---- */
.row-link { text-decoration: none; color: inherit; }
.row-link:hover strong { color: var(--accent); }
.thumb-cell img { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; display: block; border: 1px solid var(--border); }
.thumb-cell .none {
    width: 52px; height: 52px; border-radius: 6px; background: var(--bg); border: 1px dashed var(--border);
    display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .7rem;
}
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }

/* ---- Detail page ---- */
.details { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1rem 0; }
@media (max-width: 800px) { .details { grid-template-columns: 1fr 1fr; } }
.details .label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.details .value { margin-top: .15rem; font-weight: 500; }
.body-text { white-space: pre-line; line-height: 1.55; }
.progress { display: flex; gap: 0; margin: .5rem 0 0; list-style: none; padding: 0; }
.progress li { flex: 1; text-align: center; position: relative; font-size: .85rem; color: var(--muted); padding-top: 1.6rem; }
.progress li::before {
    content: ""; position: absolute; top: .3rem; left: 50%; transform: translateX(-50%);
    width: 1rem; height: 1rem; border-radius: 50%; background: var(--border); z-index: 1;
}
.progress li::after { content: ""; position: absolute; top: .72rem; left: -50%; width: 100%; height: 3px; background: var(--border); }
.progress li:first-child::after { display: none; }
.progress li.done { color: var(--text); font-weight: 600; }
.progress li.done::before, .progress li.done::after { background: var(--accent); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f9fafb; }

/* ---- Announcements / notice board ---- */
.announcements { list-style: none; margin: 0; padding: 0; }
.announcement { padding: .9rem 0; border-bottom: 1px solid var(--border); }
.announcement:first-child { padding-top: 0; }
.announcement:last-child { border-bottom: 0; padding-bottom: 0; }
.announcement-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.announcement .desc { margin-top: .45rem; white-space: pre-line; line-height: 1.5; }
.announcement.new strong::after {
    content: "New"; margin-left: .5rem; padding: .05rem .45rem; border-radius: 999px;
    font-size: .7rem; font-weight: 600; background: var(--accent); color: #fff; vertical-align: middle;
}
.announcement.important {
    border: 1px solid #fecdca; border-left: 4px solid var(--danger); background: #fef3f2;
    border-radius: 6px; padding: .8rem 1rem; margin-bottom: .75rem;
}
.announcement.important:last-child { padding-bottom: .8rem; }
.badge-important { background: var(--danger); color: #fff; margin-left: .5rem; vertical-align: middle; font-size: .7rem; }

/* ---- Strata staff dashboard ---- */
button.stat { font: inherit; text-align: left; cursor: pointer; width: 100%; }
.stat.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.stat.urgent .value { color: var(--danger); }
.page-head .filters { margin-bottom: 0; }
.card.narrow { max-width: 640px; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
label.check input { width: auto; margin: 0; }
.chips.assign { margin-top: .4rem; }
.chips.assign label { display: inline-flex; align-items: center; gap: .35rem; margin: 0 .75rem .3rem 0; font-weight: 400; }
.chips.assign input { width: auto; margin: 0; }
