:root {
  --bg: #0E0D0B;
  --card: #17150F;
  --card2: #1E1B14;
  --line: #2E2A20;
  --text: #F3EFE6;
  --muted: #A79F8C;
  --gold: #C9A45C;
  --gold-grad: linear-gradient(135deg, #F1DFAE 0%, #C9A45C 55%, #8B6B3A 100%);
  --yellow: #F2C94C;
  --red: #FF6B6B;
  --green: #4CC38A;
  --radius: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { color-scheme: dark; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
.boot { padding: 40px; text-align: center; color: var(--muted); }

/* Buttons and fields */
.btn { min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--card2); cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--gold); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--gold-grad); color: #1A1508; border-color: transparent; }
.btn.danger { color: var(--red); border-color: rgba(255,107,107,.4); background: transparent; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.mini { min-height: 32px; padding: 4px 8px; font-size: 14px; font-weight: 400; }
label { display: block; font-size: 13px; color: var(--muted); }
label > input, label > select, label > textarea { display: block; width: 100%; margin-top: 6px; }
input, select, textarea { min-height: 44px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: #100F0B; color: var(--text); font-size: 16px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
textarea { resize: vertical; }
.error { color: var(--red); font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }

/* Login */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 24px; }
.login-logo { width: min(320px, 78vw); height: auto; }
.login form { width: min(380px, 100%); display: grid; gap: 14px; }

/* Layout */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 18px; padding: calc(10px + var(--safe-top)) 18px 10px; background: rgba(14,13,11,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-logo { height: 34px; width: auto; }
.tabs { display: none; gap: 6px; margin-left: 12px; }
.tab { min-height: 40px; padding: 0 16px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; }
.tab.active { color: var(--gold); background: var(--card2); }
.who { margin-left: auto; color: var(--muted); font-size: 14px; }
.content { max-width: 1240px; margin: 0 auto; padding: 16px 16px calc(150px + var(--safe-bottom)); }
.bottom-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; background: rgba(14,13,11,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: var(--safe-bottom); }
.bottom-tabs .tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; border-radius: 0; font-size: 12px; min-height: 56px; }
.bottom-tabs svg { width: 22px; height: 22px; }
@media (min-width: 900px) {
  .tabs { display: flex; }
  .bottom-tabs { display: none; }
  .content { padding-bottom: 120px; }
}

/* Toolbar */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar h1 { font-size: 24px; }
.switch { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.switch input { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--gold); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; background: var(--line); }
.legend .l-soon::before { background: var(--yellow); }
.legend .l-late::before { background: var(--red); }
.legend .l-done::before { background: var(--green); }

/* Columns */
.segs { display: flex; gap: 6px; margin-bottom: 12px; }
.seg { flex: 1; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; }
.seg.active { border-color: var(--gold); color: var(--gold); background: var(--card2); }
.count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--line); color: var(--text); font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.cols { display: grid; gap: 14px; }
.col { display: none; }
.col.active { display: block; }
.col-head { display: none; margin-bottom: 10px; }
.col-head h2 { font-size: 18px; }
.col-head p { color: var(--muted); font-size: 13px; }
@media (min-width: 900px) {
  .segs { display: none; }
  .cols { grid-template-columns: repeat(3, 1fr); align-items: start; }
  .col { display: block; }
  .col-head { display: block; }
}
.empty { color: var(--muted); font-size: 14px; padding: 18px 4px; text-align: center; border: 1px dashed var(--line); border-radius: 14px; }
.list { display: grid; gap: 10px; }

/* Tasks */
.task { display: flex; gap: 12px; padding: 12px 14px 12px 8px; border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 14px; background: var(--card); }
.task.soon { border-left-color: var(--yellow); background: linear-gradient(90deg, rgba(242,201,76,.13), transparent 70%), var(--card); }
.task.late { border-left-color: var(--red); background: linear-gradient(90deg, rgba(255,107,107,.15), transparent 70%), var(--card); }
.task.done { border-left-color: var(--green); background: linear-gradient(90deg, rgba(76,195,138,.13), transparent 70%), var(--card); }
.task.done h3 { text-decoration: line-through; opacity: .75; }
.check { flex: none; width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; }
.check span { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--muted); display: grid; place-items: center; }
.check svg { width: 16px; height: 16px; opacity: 0; }
.task.done .check span { background: var(--green); border-color: var(--green); }
.task.done .check svg { opacity: 1; color: #06210F; }
.task-main { flex: 1; min-width: 0; cursor: pointer; padding-top: 2px; }
.task-main h3 { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.notes { color: var(--muted); font-size: 14px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); font-weight: 600; }
.pill.soon { color: var(--yellow); border-color: rgba(242,201,76,.5); }
.pill.late { color: var(--red); border-color: rgba(255,107,107,.5); }
.pill.done { color: var(--green); border-color: rgba(76,195,138,.5); }
.take { align-self: center; flex: none; }
.fab { position: fixed; right: 16px; bottom: calc(76px + var(--safe-bottom)); z-index: 6; min-height: 52px; padding: 0 22px; border-radius: 26px; border: 0; background: var(--gold-grad); color: #1A1508; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.5); cursor: pointer; }
@media (min-width: 900px) { .fab { bottom: 24px; right: 24px; } }

/* Modal */
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.65); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: min(560px, 100%); max-height: 92vh; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 22px 22px 0 0; padding: 20px 18px calc(20px + var(--safe-bottom)); display: grid; gap: 14px; }
.sheet h2 { font-size: 20px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 22px; } }

/* Hours */
.weekbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.weeklabel { font-weight: 700; min-width: 190px; text-align: center; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
td.name { font-weight: 600; min-width: 120px; }
td input.num { width: 92px; text-align: right; }
th.r, td.r { text-align: right; }
tfoot td { font-weight: 700; border-bottom: 0; color: var(--gold); }
.pay { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.wrow { display: grid; grid-template-columns: 1fr 90px auto; gap: 8px; align-items: center; }
.wrow.off { opacity: .55; }
.wrow label.chk { display: flex; align-items: center; gap: 6px; }
.wrow input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--gold); }
.preview { max-height: 220px; overflow: auto; font-size: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.preview .bad { color: var(--red); }
.preview .ok { color: var(--green); }

/* Settings */
.stack { display: grid; gap: 14px; max-width: 520px; }
.stack h2 { font-size: 18px; }

/* Toast */
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(150px + var(--safe-bottom)); z-index: 30; background: #2A261B; border: 1px solid var(--gold); padding: 10px 16px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; }
#toast.show { opacity: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Accounts */
.acct { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.acct.off { opacity: .6; }
.acct h3 { font-size: 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.acct-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Month view */
.week { margin-bottom: 22px; }
.week-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.week-head h2 { font-size: 17px; }
.month-sum { margin-top: 30px; }
.month-sum .week-head h2 { color: var(--gold); font-size: 20px; }
.weekbar select { min-height: 40px; min-width: 190px; font-weight: 700; text-align: center; }

/* Header log out */
.logout-top { margin-left: 10px; flex: none; }
@media (max-width: 520px) { .who { display: none; } .logout-top { margin-left: auto; } }

/* Administrator: read-only mirror */
.ro-note { margin-bottom: 12px; padding: 10px 14px; border: 1px dashed var(--gold); border-radius: 12px; color: var(--gold); font-size: 14px; }
.check.ro { pointer-events: none; }
input[readonly] { opacity: .85; cursor: default; }
/* Worker details */
.staff-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; }
.staff-contact { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; }
.staff-contact a { color: var(--gold); text-decoration: none; overflow-wrap: anywhere; }
.staff-arch-head { font-size: 17px; margin: 26px 0 10px; color: var(--muted); }
.staff-active { align-self: end; min-height: 44px; }
@media (max-width: 420px) { .staff-list { grid-template-columns: 1fr; } }
.staff-danger { border-top: 1px solid var(--line); padding-top: 12px; }

/* Settings button in the header (phone only; on a computer Settings is in the top menu) */
.cog-top { margin-left: auto; width: 40px; padding: 0; display: grid; place-items: center; }
.cog-top svg { width: 20px; height: 20px; }
.cog-top.active { color: var(--gold); border-color: var(--gold); }
.cog-top + .logout-top { margin-left: 8px; }
@media (min-width: 900px) { .cog-top { display: none; } .cog-top + .logout-top { margin-left: 10px; } }
@media (max-width: 520px) { .bottom-tabs .tab { font-size: 11px; } }

/* Schedules */
table.sched th.c, table.sched td.c { text-align: center; padding: 6px 4px; }
table.sched th.c span { font-weight: 400; text-transform: none; letter-spacing: 0; }
table.sched th.today { color: var(--gold); }
table.sched td.today { background: rgba(201,164,92,.08); }
table.sched td.c input { width: 88px; min-height: 38px; padding: 6px 6px; text-align: center; font-size: 15px; }
table.sched td.name { position: sticky; left: 0; z-index: 1; background: var(--card); }

/* Contacts */
.search { width: 100%; margin-bottom: 12px; }
.task:not(.done) .check.ro span { opacity: .4; border-style: dashed; }

/* Light calendar icon in date fields (dark theme) */
input[type=date]::-webkit-calendar-picker-indicator { opacity: 1; cursor: pointer; }

/* Heiko's calendar */
.cal-week { display: grid; gap: 10px; }
@media (min-width: 900px) { .cal-week { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); align-items: start; } }
.cal-day { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 6px; }
.cal-day.today { border-color: var(--gold); }
.cal-day h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.cal-day.today h2 { color: var(--gold); }
.cal-none { padding: 2px 0; }
.cal-ev { display: flex; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--card2); border-left: 3px solid var(--gold); cursor: pointer; }
.cal-ev.allday { border-left-color: var(--green); }
.cal-ev.past { opacity: .55; }
.cal-time { flex: none; width: 92px; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--gold); }
.cal-ev.allday .cal-time { color: var(--green); }
.cal-main { min-width: 0; flex: 1; }
.cal-main h3 { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.cal-note { margin-top: 4px; font-size: 14px; color: var(--yellow); overflow-wrap: anywhere; white-space: pre-wrap; }
.cal-add { margin-top: 2px; }
.cal-desc { font-size: 14px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 200px; overflow: auto; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--text); }
.cal-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; font-size: 13px; color: var(--muted); }

/* Unread badge on a tab */
.tab { position: relative; }
.tab .badge { position: absolute; top: 4px; right: calc(50% - 22px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.tabs .tab .badge { position: static; margin-left: 6px; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: inherit; }

/* Chat */
.chat-wrap { max-width: 760px; margin: 0 auto; }
.chat-head { margin-bottom: 4px; }
.chat-head h1 .hint { font-size: 16px; font-weight: 500; }
.chat-calls { display: flex; gap: 6px; }
.chat-privacy { margin-bottom: 10px; }
.chat-list { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; }
.chat-day { align-self: center; font-size: 12px; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 2px 12px; margin: 10px 0 4px; }
.chat-msg { display: flex; }
.chat-msg.own { justify-content: flex-end; }
.chat-msg .bubble { max-width: min(80%, 520px); background: var(--card2); border: 1px solid var(--line); border-radius: 18px 18px 18px 6px; padding: 8px 12px; display: grid; gap: 6px; }
.chat-msg.own .bubble { background: #3A2F17; border-color: #5C4A22; border-radius: 18px 18px 6px 18px; }
.chat-from { font-size: 12px; font-weight: 700; color: var(--gold); }
.chat-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-text a { color: var(--gold); }
.chat-meta { font-size: 11px; color: var(--muted); text-align: right; }
.chat-img img { display: block; max-width: 100%; max-height: 320px; border-radius: 12px; }
.chat-video { display: block; max-width: 100%; max-height: 360px; border-radius: 12px; background: #000; }
.chat-file { display: flex; gap: 10px; align-items: center; color: var(--text); text-decoration: none; padding: 6px 4px; }
.chat-file-icon { font-size: 26px; }
.chat-form { position: sticky; bottom: calc(64px + var(--safe-bottom)); background: var(--bg); padding: 8px 0 6px; border-top: 1px solid var(--line); }
@media (min-width: 900px) { .chat-form { bottom: 0; padding-bottom: 14px; } }
.chat-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-row textarea { flex: 1; min-height: 44px; max-height: 160px; resize: none; }
.chat-attach { font-size: 20px; min-height: 44px; display: inline-flex; align-items: center; cursor: pointer; }
.chat-row .btn.primary { min-height: 44px; }
.chat-chip { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; margin-bottom: 6px; }

/* Push notification banner */
.push-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; padding: 10px 14px; border: 1px solid var(--gold); border-radius: 12px; background: var(--card); font-size: 14px; }
.push-banner span { flex: 1; min-width: 200px; }

/* Call screen */
.call { position: fixed; inset: 0; z-index: 50; background: radial-gradient(circle at 50% 30%, #2A2416, #0B0A08 70%); display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: calc(40px + var(--safe-top)) 20px calc(30px + var(--safe-bottom)); color: var(--text); }
.call-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.call.video.active .call-top { background: rgba(0,0,0,.45); border-radius: 16px; padding: 8px 14px; }
.call.video.active .call-avatar { display: none; }
.call-top { position: relative; z-index: 1; display: grid; justify-items: center; gap: 14px; text-align: center; }
.call-avatar { width: 110px; height: 110px; border-radius: 50%; background: var(--gold-grad); color: #1A1508; font-size: 48px; font-weight: 800; display: grid; place-items: center; }
.call.ringing .call-avatar, .call.calling .call-avatar { animation: callPulse 1.4s ease-in-out infinite; }
@keyframes callPulse { 50% { box-shadow: 0 0 0 18px rgba(201,164,92,.18); } }
.call-status { font-size: 20px; font-weight: 700; }
.call-local { position: absolute; z-index: 2; right: 16px; top: calc(16px + var(--safe-top)); width: 110px; height: 160px; object-fit: cover; border-radius: 14px; border: 2px solid rgba(255,255,255,.35); background: #111; transform: scaleX(-1); }
.call-actions { position: relative; z-index: 1; display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.call-btn { width: 68px; height: 68px; border-radius: 50%; border: 0; background: rgba(255,255,255,.16); color: #fff; font-size: 26px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; }
.call-btn span { position: absolute; top: 74px; font-size: 12px; white-space: nowrap; color: var(--muted); }
.call-btn.off { background: #fff; color: #111; }
.call-btn.decline { background: #E5484D; }
.call-btn.accept { background: #30A46C; }
.chat-attach input[type=file] { display: none !important; }

/* Heiko's calendar: month grid */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; margin-bottom: 12px; }
.cal-wd { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 2px 0 3px; }
.cal-cell { position: relative; min-height: 48px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); cursor: pointer; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.cal-cell.out { opacity: .38; }
.cal-cell.pastday:not(.today) .cal-num { color: var(--muted); }
.cal-cell.sel { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.cal-num { font-size: 13px; font-weight: 700; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-cell.today .cal-num { background: var(--gold-grad); color: #1A1508; }
.cal-chips { display: none; }
.cal-dots { display: flex; gap: 3px; flex-wrap: wrap; align-items: center; padding-left: 3px; }
.cal-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.cal-dots i.allday { background: var(--green); }
.cal-dots em { font-style: normal; font-size: 10px; color: var(--muted); }
@media (min-width: 900px) {
  .cal-cell { min-height: 80px; }
  .cal-chips { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .cal-dots { display: none; }
}
.cal-chip { display: block; font-size: 12px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 1px 5px; border-radius: 5px; background: var(--card2); border-left: 3px solid var(--gold); }
.cal-chip.allday { border-left-color: var(--green); }
.cal-chip.past { opacity: .55; }
.cal-chip:hover { background: #2A2518; }
.cal-more { font-size: 11px; color: var(--muted); padding-left: 5px; }
.cal-agenda { max-width: 760px; }
.wrow.wedit { grid-template-columns: 1fr 80px auto auto; }
@media (max-width: 520px) { .wrow.wedit { grid-template-columns: 1fr 72px; } .wrow.wedit label.chk, .wrow.wedit .btn { justify-self: start; } }
.wrow.wedit + .wrow.wedit { border-top: 1px solid var(--line); padding-top: 8px; }
.warch-head { font-size: 15px; color: var(--muted); margin-top: 6px; }
.warch { display: flex; align-items: center; justify-content: space-between; gap: 8px; opacity: .8; }

/* Task images */
.task-images-gallery { margin-top: 12px; }
.task-images-gallery h3 { font-size: 15px; margin-bottom: 10px; color: var(--text); }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
.img-item { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--card2); }
.img-item img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.img-item .placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 20px; }
.img-delete { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; padding: 0; border-radius: 50%; background: rgba(0,0,0,.7); border: 0; color: var(--red); cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s; }
.img-item:hover .img-delete { opacity: 1; }
.img-delete:hover { background: rgba(0,0,0,.9); }
.task-images-upload { margin-bottom: 12px; }
.task-img-upload { display: inline-block; }
.task-img-upload input[type=file] { display: none; }

/* Thumbnail previews on task cards */
.task-images { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.task-img-thumb { width: 56px; height: 56px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--card2); cursor: pointer; flex-shrink: 0; }
.task-img-thumb img { width: 100%; height: 100%; object-fit: cover; }
.task-images-more { width: 56px; height: 56px; border-radius: 8px; border: 1px solid var(--line); background: var(--card2); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: var(--muted); flex-shrink: 0; }

/* Chat: files open inside the app, own messages can be corrected or deleted */
.chat-img { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; }
button.chat-file { width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: rgba(0,0,0,.18); cursor: pointer; padding: 8px; font: inherit; }
button.chat-file:hover { border-color: var(--gold); }
.chat-file.pdf { align-items: flex-start; }
.chat-pdf-thumb { width: 110px; max-height: 150px; object-fit: cover; object-position: top; border-radius: 6px; background: #fff; flex: none; }
.chat-file-info { display: grid; gap: 2px; min-width: 0; }
.chat-file-info strong { overflow-wrap: anywhere; }
.chat-file-open { font-size: 13px; color: var(--gold); font-weight: 700; margin-top: 2px; }
.chat-audio { width: 100%; min-width: 220px; }
.chat-actions { display: flex; gap: 6px; justify-content: flex-end; }
.chat-act { border: 1px solid var(--line); background: rgba(0,0,0,.2); color: var(--text); border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.chat-act.danger { color: var(--red); border-color: rgba(255,107,107,.35); }
.chat-edit { display: grid; gap: 6px; min-width: min(70vw, 360px); }
.chat-edit textarea { min-height: 60px; }
.chat-edit-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* File viewer (full screen) */
body.viewer-open { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 40; background: #0B0A08; display: flex; flex-direction: column; }
.viewer-bar { display: flex; align-items: center; gap: 8px; padding: calc(10px + var(--safe-top)) 12px 10px; border-bottom: 1px solid var(--line); background: var(--card); }
.viewer-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-body { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; padding: 12px 12px calc(20px + var(--safe-bottom)); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.viewer-img { max-width: 100%; max-height: calc(100vh - 110px); object-fit: contain; }
.viewer-media { max-width: 100%; max-height: calc(100vh - 110px); background: #000; }
.viewer-audio { width: min(100%, 520px); margin-top: 30vh; }
.viewer-page { max-width: 100%; background: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.5); }
.viewer-doc { width: min(100%, 820px); background: #fff; color: #111; padding: 28px 24px; border-radius: 6px; line-height: 1.5; overflow-wrap: anywhere; }
.viewer-doc h1, .viewer-doc h2, .viewer-doc h3 { margin: .6em 0 .3em; }
.viewer-doc p { margin: 0 0 .7em; }
.viewer-doc table { border-collapse: collapse; margin: .6em 0; }
.viewer-doc td, .viewer-doc th { border: 1px solid #bbb; padding: 4px 6px; color: #111; }
.viewer-doc img { max-width: 100%; height: auto; }
.viewer-doc a { color: #0645ad; }
.viewer-table { width: 100%; }
.viewer-table th { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--gold); white-space: nowrap; }
.viewer-table td { white-space: nowrap; font-size: 14px; }
.viewer-sheet { align-self: flex-start; font-size: 16px; color: var(--gold); }
.viewer-text { width: min(100%, 900px); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 0; }
.viewer-other { margin-top: 20vh; text-align: center; display: grid; gap: 12px; justify-items: center; }
.viewer-other .chat-file-icon { font-size: 48px; }

/* New schedule view */
.sched-worker { margin-bottom: 32px; padding: 16px; background: var(--card); border-radius: 10px; border: 1px solid var(--line); }
.sched-worker h3 { margin-bottom: 4px; font-size: 18px; }
.sched-meta { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.sched-new { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.sched-new th, .sched-new td { border: 1px solid var(--line); padding: 8px; }
.sched-new th { background: var(--card2); font-weight: 600; text-align: center; font-size: 12px; }
.sched-new th.today, .sched-new td.today { background: rgba(201, 164, 92, 0.1); }
.sched-cell { display: flex; flex-direction: column; gap: 6px; min-height: 100px; }
.sched-item { display: flex; gap: 4px; align-items: flex-start; }
.sched-item.save-error { opacity: 0.7; }
.sched-item.save-conflict { opacity: 0.85; }
.sched-input { flex: 1; min-height: 28px; padding: 4px 6px; font-size: 12px; border-radius: 4px; border: 1px solid var(--line); background: #100F0B; }
.save-state { display: inline-block; font-size: 12px; width: 16px; height: 16px; line-height: 16px; text-align: center; }
.btn.retry { padding: 2px 4px; font-size: 11px; }
.sched-notes-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.sched-notes-section h4 { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.sched-notes { width: 100%; min-height: 80px; padding: 8px; font-size: 12px; border-radius: 6px; border: 1px solid var(--line); background: #100F0B; resize: vertical; }
.sched-actions { display: flex; gap: 6px; margin-top: 12px; }

/* Dashboard */
.top-logo-btn { display: flex; align-items: center; justify-content: center; background: none; border: 0; padding: 0; cursor: pointer; }
.top-logo-btn:hover img { opacity: 0.9; }
.top-logo-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.link-btn { display: inline; background: none; border: 0; padding: 0; color: var(--gold); cursor: pointer; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { opacity: 0.9; }
.link-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.dash-container { display: grid; gap: 16px; padding: 0; }
.dash-greeting { padding: 24px; text-align: center; }
.dash-greeting h1 { font-size: 28px; margin-bottom: 8px; }
.dash-greeting p { margin: 0; }
.dash-calendar, .dash-tasks, .dash-events { padding: 20px; }
.dash-calendar h2, .dash-tasks h2, .dash-events h2 { font-size: 18px; margin-bottom: 14px; }
.dash-cal-events { display: grid; gap: 10px; margin-bottom: 12px; }
.dash-cal-event { padding: 12px; background: var(--card2); border-radius: 12px; border-left: 3px solid var(--gold); }
.dash-cal-event.allday { border-left-color: var(--yellow); }
.dash-cal-time { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.dash-cal-title { font-size: 14px; font-weight: 600; }
.dash-task-list { display: grid; gap: 8px; margin-bottom: 12px; }
.dash-task-item { padding: 12px; }
.dash-task-item .check { width: 24px; height: 24px; flex-shrink: 0; }
.dash-task-info { flex: 1; min-width: 0; }
.dash-task-title { font-size: 14px; font-weight: 600; }
.dash-task-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.dash-birthdays { display: grid; gap: 8px; margin-bottom: 12px; }
.dash-birthday { padding: 12px; background: var(--card2); border-radius: 12px; border-left: 3px solid var(--gold); display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.dash-birthday-label { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.dash-birthday-name { font-size: 14px; font-weight: 600; }
.dash-birthday-when { font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.dash-anniversaries { display: grid; gap: 8px; margin-bottom: 12px; }
.dash-anniversary { padding: 12px; background: var(--card2); border-radius: 12px; border-left: 3px solid var(--gold); display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.dash-anniversary-name { font-size: 14px; font-weight: 600; }
.dash-anniversary-years { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }

@media (min-width: 900px) {
  .dash-container { grid-template-columns: repeat(2, 1fr); }
  .dash-greeting { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  .sched-cell { min-height: 80px; font-size: 11px; }
  .sched-new th, .sched-new td { padding: 4px; font-size: 11px; }
  .sched-input { font-size: 11px; }
}
