/* PERETZ client portal. Palette and type follow peretz.agency; the signed-in app is a CRM-style
   workspace: sidebar, cards, coloured status pills, time bars and side panels. */
:root {
    --bg: #f9f6f0;          /* site background */
    --panel: #f0ece4;       /* site form section / field background */
    --card: #ffffff;
    --ink: #2d2d2d;         /* site text */
    --muted: #676052;       /* site secondary text */
    --muted-2: #867e6c;
    --line: #e6e0d4;
    --line-2: #bfb8a8;
    --accent: #ce1414;      /* PERETZ red */
    --ok: #2f6b3a;
    --ok-bg: #e3ecdf;
    --info: #1a4f9c;
    --info-bg: #e6ecf5;
    --warn: #8a5a00;
    --warn-bg: #f7ecd6;
    --late-bg: #f6dfdf;
    --radius: 10px;
    /* SF Pro comes from the system on Apple devices; the font files are not served (Apple licence). */
    --font: -apple-system, "SF Pro Display", BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--font); }
a { color: inherit; }
p { margin: 0 0 12px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; }
.i { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hint { margin: 6px 0 0; font-size: 12px; color: var(--muted-2); }

/* ---------- Guest pages (sign in, password) ---------- */
body.guest { min-height: 100vh; display: flex; flex-direction: column; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px 5.5vw; border-bottom: 1px solid var(--panel); }
.logo { display: block; line-height: 0; }
.logo svg { width: 92px; height: 21px; }
.langs { display: flex; gap: 12px; }
.langs a { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; text-decoration: none; color: var(--ink); }
.langs a.active { color: var(--accent); }
body.guest main { flex: 1; width: 100%; max-width: 440px; margin: 9vh auto 12vh; padding: 0 20px; }
footer.bottom { padding: 22px 5.5vw; font-size: 12px; color: var(--muted-2); letter-spacing: .04em; }
body.guest h1 { margin: 0 0 28px; font-size: 32px; line-height: 1.25; font-weight: 400; letter-spacing: .01em; text-transform: uppercase; }

/* ---------- Form controls (everywhere) ---------- */
label { display: block; margin: 16px 0 7px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
input[type=email], input[type=password], input[type=text], input[type=url], input[type=date], input#code, input#recovery_code, select, textarea {
    width: 100%; min-height: 44px; padding: 11px 14px; border: 1px solid transparent; border-radius: 8px;
    background: var(--panel); color: var(--ink); font: 400 15px/1.4 var(--font); outline: none; -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); background-color: #fff; }
input#code, input#recovery_code { letter-spacing: .3em; font-size: 18px; }
input.bad { border-color: var(--accent); }
input.good { border-color: var(--ok); }
.check { display: flex; align-items: center; gap: 10px; margin-top: 14px; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 14px; color: var(--ink); }
.check input { width: 16px; height: 16px; accent-color: var(--ink); flex: none; }
.checks { padding: 2px 14px 12px; border-radius: 8px; background: var(--panel); }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Guest buttons: outlined, uppercase (site look). */
body.guest button, a.button {
    display: block; width: 100%; height: 50px; margin-top: 26px; padding: 0 16px; border: 1px solid var(--ink); border-radius: 0;
    background: transparent; color: var(--ink); font: 600 13px/48px var(--font); letter-spacing: .1em; text-transform: uppercase;
    text-align: center; text-decoration: none; cursor: pointer; transition: background .2s, color .2s;
}
body.guest button:hover, a.button:hover { background: var(--ink); color: var(--bg); }
button.link-button { display: inline; width: auto; height: auto; margin: 0; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; line-height: inherit; text-transform: none; letter-spacing: 0; cursor: pointer; }
button.link-button:hover { background: none; color: var(--accent); }
button.link-button:disabled { opacity: .35; cursor: default; }

/* App buttons: compact, rounded, CRM-like. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--card); color: var(--ink); font: 500 14px var(--font); text-decoration: none; cursor: pointer; white-space: nowrap; transition: border-color .15s, background .15s; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #000; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--panel); }
.btn.small { height: 32px; padding: 0 10px; font-size: 13px; }
.btn.danger:hover { color: var(--accent); }
.btn:disabled { opacity: .4; cursor: default; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.icon-button:hover { background: var(--panel); color: var(--ink); }

/* Messages. */
.error { margin: 12px 0 0; font-size: 14px; color: var(--accent); }
.status { margin: 0 0 18px; padding: 12px 16px; border-radius: 8px; background: var(--panel); font-size: 14px; color: var(--ok); }
.toast { display: flex; align-items: center; gap: 8px; margin: 0 0 18px; padding: 10px 14px; border-radius: 8px; background: var(--ok-bg); color: var(--ok); font-size: 14px; }

/* Password rules and show/hide. */
.rules { list-style: none; margin: 12px 0 0; padding: 0; font-size: 13px; }
.rules li { color: var(--accent); }
.rules li::before { content: "\2715  "; }
.rules li.ok { color: var(--ok); }
.rules li.ok::before { content: "\2713  "; }
.pw { position: relative; }
.pw input { padding-right: 96px; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: auto !important; height: auto !important; margin: 0 !important; padding: 6px 8px !important; border: 0 !important; background: none !important; color: var(--muted) !important; font-size: 11px !important; line-height: 1 !important; }
.below { margin-top: 26px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.below a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line-2); padding-bottom: 2px; }
.below a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- App shell ---------- */
body.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; padding: 22px 14px; background: var(--card); border-right: 1px solid var(--line); }
.sidebar .logo { padding: 4px 10px 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 14px; }
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a.on { background: var(--panel); color: var(--ink); font-weight: 600; }
.me { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.me-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 6px; }
.me-row form { margin: 0; }
.me-name { flex: 1; display: flex; flex-direction: column; font-size: 14px; font-weight: 600; line-height: 1.25; min-width: 0; }
.me-name small { font-weight: 400; color: var(--muted-2); font-size: 12px; }
.topbar { display: none; }
.workspace { padding: 30px 36px 60px; max-width: 1240px; width: 100%; }

.avatar { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--panel); color: var(--muted); font-size: 13px; font-weight: 600; flex: none; }
.avatar.small { width: 24px; height: 24px; font-size: 10px; }
.avatar.dark { background: var(--ink); color: #fff; }
.avatars { display: inline-flex; }
.avatars .avatar { margin-left: -6px; border: 2px solid var(--card); }

/* Page heading. */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.page-title { margin: 0 0 4px; font-size: 26px; line-height: 1.25; font-weight: 500; letter-spacing: 0; text-transform: none; }
h1 { margin: 0 0 20px; font-size: 26px; font-weight: 500; }
.section-title { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
section > .section-title { margin-bottom: 12px; }
.crumbs { display: flex; align-items: center; gap: 4px; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs .i { width: 14px; height: 14px; }

/* Cards and tiles. */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.card + .card { margin-top: 12px; }
.card.narrow { max-width: 560px; }
.card.empty { color: var(--muted); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-label { margin-bottom: 6px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); }
.big-line { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 600; }
.late-text { color: var(--accent); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 26px; }
.tile { padding: 14px 16px; border-radius: var(--radius); background: var(--panel); }
.tile span { display: block; font-size: 13px; color: var(--muted); }
.tile strong { display: block; margin-top: 4px; font-size: 28px; font-weight: 500; line-height: 1.1; }
.tile.alert { background: var(--late-bg); }
.tile.alert strong, .tile.alert span { color: var(--accent); }
.grid-main-side { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.side .card + .card { margin-top: 12px; }

/* Project cards. */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.project-card { display: block; text-decoration: none; transition: border-color .15s, transform .15s; }
.project-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.card .card-head { margin-bottom: 14px; align-items: flex-start; }
.card-title { font-size: 16px; font-weight: 600; line-height: 1.3; }
.card-sub { font-size: 13px; color: var(--muted); }
.card-row { display: flex; justify-content: space-between; margin-top: 6px; font-size: 13px; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; }
.next { display: inline-flex; align-items: center; gap: 6px; }
.progress { height: 6px; border-radius: 3px; background: var(--panel); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 3px; background: var(--ink); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }

/* Status pills (projects and stages). */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; white-space: nowrap; line-height: 1.5; }
.pill .i { width: 14px; height: 14px; }
.pill.status-brief, .pill.stage-planned { background: var(--panel); color: var(--muted); }
.pill.status-in_progress, .pill.stage-in_progress { background: var(--info-bg); color: var(--info); }
.pill.status-approval, .pill.stage-approval { background: var(--warn-bg); color: var(--warn); }
.pill.status-paused, .pill.stage-delayed { background: var(--late-bg); color: var(--accent); }
.pill.status-delivered, .pill.stage-done { background: var(--ok-bg); color: var(--ok); }

/* Status menu (click the pill). */
details.menu-pop { position: relative; display: inline-block; }
details.menu-pop > summary { list-style: none; cursor: pointer; }
details.menu-pop > summary::-webkit-details-marker { display: none; }
details.menu-pop .menu { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; min-width: 190px; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(45, 45, 45, .12); }
details.menu-pop.right .menu { left: auto; right: 0; }
details.menu-pop .menu form { margin: 0; }
details.menu-pop .menu button { display: flex; width: 100%; padding: 6px; border: 0; border-radius: 6px; background: none; cursor: pointer; }
details.menu-pop .menu button:hover, details.menu-pop .menu button.current { background: var(--bg); }

/* Project page. */
.project-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }
.project-head-main { flex: 1; min-width: 260px; }
.project-meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 8px; font-size: 14px; color: var(--muted); }
.project-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.project-progress { display: flex; align-items: center; gap: 12px; max-width: 520px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.project-progress .progress { flex: 1; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.link-chip { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px 0 0; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-size: 13px; }
.link-chip a { display: inline-flex; align-items: center; gap: 7px; padding: 7px 4px 7px 11px; text-decoration: none; color: var(--ink); }
.link-chip a .i:last-child { width: 14px; height: 14px; color: var(--muted-2); }
.link-chip a:hover { color: var(--accent); }
.link-chip .lock { display: inline-flex; color: var(--muted-2); }
.link-chip .lock .i { width: 14px; height: 14px; }
.link-chip form { margin: 0; display: inline-flex; }
.chip-x { display: inline-flex; padding: 3px; border: 0; border-radius: 6px; background: none; color: var(--muted-2); cursor: pointer; }
.chip-x:hover { color: var(--accent); background: var(--bg); }
.chip-x .i { width: 14px; height: 14px; }
.link-chip.add { padding: 7px 12px; border-style: dashed; color: var(--muted); cursor: pointer; font: inherit; font-size: 13px; gap: 6px; }
.link-chip.add:hover { color: var(--ink); border-color: var(--line-2); }
.changes { margin-bottom: 20px; }
.changes .card-head { margin-bottom: 6px; }

/* Activity feed. */
.feed { list-style: none; margin: 0; padding: 0; }
.feed-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.feed-item:last-child { border-bottom: 0; }
.feed-text { font-size: 14px; }
.feed-text a { font-weight: 600; text-decoration: none; }
.feed-text a:hover { color: var(--accent); }
.feed-meta { font-size: 12px; color: var(--muted-2); }
.feed.compact { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
.feed.compact .feed-item:nth-last-child(2):nth-child(odd) { border-bottom: 0; }

/* Stages. */
.stage-list { list-style: none; margin: 0; padding: 0; }
.stage-item { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.stage-item:last-child { border-bottom: 0; }
.stage-icon { color: var(--muted-2); padding-top: 1px; }
.stage-icon .i { width: 22px; height: 22px; }
.stage-item.is-done .stage-icon { color: var(--ok); }
.stage-item.is-in_progress .stage-icon { color: var(--info); }
.stage-item.is-approval .stage-icon { color: var(--warn); }
.stage-item.is-delayed .stage-icon { color: var(--accent); }
.stage-line { display: flex; align-items: center; gap: 8px; }
.stage-name { font-weight: 600; font-size: 15px; }
.stage-item.is-done .stage-name { color: var(--muted); }
button.as-link { padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
button.as-link:hover { color: var(--accent); }
.stage-note { margin-top: 2px; font-size: 13px; color: var(--muted); }
.stage-side { display: flex; align-items: center; gap: 12px; }
.stage-due { min-width: 42px; text-align: right; font-size: 13px; color: var(--muted); }

/* Time bar: fills as the stage's time passes. The fill shows a green → amber → red heat scale laid
   over the whole track, so the closer to the due date, the hotter its end; done is solid green,
   overdue solid red, not started grey. */
.timebar { display: flex; align-items: center; gap: 10px; max-width: 440px; margin-top: 9px; }
.timebar .track { flex: 1; height: 8px; border-radius: 4px; background: var(--panel); overflow: hidden; }
.timebar .track i { display: block; height: 100%; border-radius: 4px; min-width: 6px;
    background: linear-gradient(90deg, #3aa357 0%, #8cbf3f 35%, #e8b123 65%, #e2701a 85%, #ce1414 100%);
    background-size: calc(10000% / var(--p, 100)) 100%; }
.timebar .label { font-size: 12px; color: var(--muted-2); white-space: nowrap; }
.tone-ok .label { color: #2f7d45; }
.tone-soon .label { color: #b36b00; font-weight: 600; }
.tone-late .track i { background: var(--accent); }
.tone-late .label { color: var(--accent); font-weight: 600; }
.tone-done .track i { background: #3aa357; }
.tone-done .label { color: var(--ok); }
.tone-future .track i { background: var(--line-2); min-width: 0; }
.tone-none .track { background: repeating-linear-gradient(90deg, var(--panel) 0 6px, transparent 6px 10px); }
.tone-none .track i { min-width: 0; }

/* Documents: chips under a stage, folders in the Files section, file rows. */
.stage-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.file-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 4px 10px 4px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--ink); font: 400 12px var(--font); text-decoration: none; cursor: pointer; }
.file-chip .i { width: 14px; height: 14px; color: var(--muted-2); }
.file-chip:hover { border-color: var(--line-2); color: var(--accent); }
.file-chip.add { border-style: dashed; background: none; color: var(--muted); }
.ver { display: inline-block; padding: 0 5px; border-radius: 4px; background: var(--info-bg); color: var(--info); font-size: 11px; font-weight: 600; }
.main-col > .card + .card { margin-top: 20px; }
.files-card .section-title, .card-title.plain { display: inline-flex; align-items: center; gap: 8px; }
.card-title.plain { text-decoration: none; }
.card-title.plain:hover { color: var(--accent); }
details.folder { border-top: 1px solid var(--line); }
details.folder > summary { display: flex; align-items: center; gap: 8px; padding: 12px 0; list-style: none; font-weight: 600; font-size: 14px; color: var(--ink); }
details.folder > summary::-webkit-details-marker { display: none; }
details.folder > summary .i { color: #c08a1e; }
details.folder > summary .count { padding: 0 7px; border-radius: 10px; background: var(--panel); color: var(--muted); font-size: 12px; font-weight: 500; }
.folder-label { display: flex; align-items: center; gap: 8px; margin: 14px 0 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.folder-label .i { color: #c08a1e; }
.file-list { list-style: none; margin: 0 0 8px; padding: 0; }
.file-row { display: flex; align-items: flex-start; gap: 12px; padding: 9px 4px 9px 26px; border-radius: 8px; }
.file-row:hover { background: var(--bg); }
.file-row form { margin: 0; }
.file-ext { flex: none; width: 40px; padding: 5px 0; border-radius: 6px; background: var(--panel); color: var(--muted); font-size: 10px; font-weight: 700; text-align: center; text-transform: uppercase; letter-spacing: .04em; }
.file-ext.ext-pdf { background: #f6dfdf; color: #b32424; }
.file-ext.ext-doc, .file-ext.ext-docx, .file-ext.ext-odt, .file-ext.ext-rtf, .file-ext.ext-txt { background: #e6ecf5; color: #1a4f9c; }
.file-ext.ext-xls, .file-ext.ext-xlsx, .file-ext.ext-ods, .file-ext.ext-csv { background: #e3ecdf; color: #2f6b3a; }
.file-ext.ext-ppt, .file-ext.ext-pptx { background: #f7e6d6; color: #a14f0a; }
.file-main { flex: 1; min-width: 0; }
.file-name { font-weight: 600; font-size: 14px; text-decoration: none; word-break: break-word; }
.file-name:hover { color: var(--accent); }
.file-meta { margin-top: 2px; font-size: 12px; color: var(--muted-2); }
.history summary { margin-top: 4px; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.history summary .i { width: 14px; height: 14px; }
.history ul { margin: 6px 0 0; padding-left: 18px; font-size: 12px; color: var(--muted); }
input[type=file].file-input { width: 100%; padding: 14px; border: 1px dashed var(--line-2); border-radius: 8px; background: var(--bg); font: 400 14px var(--font); }

/* Calendar. */
.cal-filter select { min-width: 220px; }
.cal-card { padding: 0; overflow: hidden; }
.cal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-nav .icon-button:first-child .i { transform: rotate(-90deg); }
.cal-nav .icon-button:nth-child(2) .i { transform: rotate(-90deg); }
.cal-month { margin: 0 0 0 8px; font-size: 20px; font-weight: 500; }
.cal-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend { display: inline-flex; align-items: center; gap: 6px; }
.ev-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--info-bg); border: 1px solid var(--info); }
.ev-dot.milestone { background: var(--accent); border-color: var(--accent); }
.ev-dot.done { background: var(--ok-bg); border-color: var(--ok); }
.ev-dot.late { background: #fff; border: 2px solid var(--accent); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { padding: 8px 10px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); border-bottom: 1px solid var(--line); }
.cal-day { min-height: 112px; padding: 6px 6px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.cal-day:nth-child(7n + 7) { border-right: 0; }
.cal-day.weekend { background: #fcfaf6; }
.cal-day.other { background: var(--bg); }
.cal-day.other .cal-num { color: var(--line-2); }
.cal-num { font-size: 12px; font-weight: 600; color: var(--muted); padding: 2px 4px; }
.cal-day.today .cal-num { display: inline-block; align-self: flex-start; padding: 2px 7px; border-radius: 10px; background: var(--ink); color: #fff; }
.ev { display: block; padding: 3px 7px; border-radius: 6px; background: var(--info-bg); color: var(--info); font-size: 12px; font-weight: 500; line-height: 1.3; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid transparent; }
.ev:hover { filter: brightness(.96); }
.ev-project { display: block; font-size: 11px; font-weight: 400; opacity: .8; overflow: hidden; text-overflow: ellipsis; }
.ev.ev-milestone { background: #fbe3e3; color: #a51010; }
.ev.ev-deadline { background: var(--accent); color: #fff; }
.ev.ev-done { background: var(--ok-bg); color: var(--ok); }
.ev.ev-late { border-color: var(--accent); }
.ev-more { padding: 0 6px; font-size: 11px; color: var(--muted); }
.cal-upcoming { margin-top: 20px; }
.cal-upcoming .section-title { margin-bottom: 12px; }
.up-day { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.up-date { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
.up-date strong { font-size: 18px; font-weight: 600; color: var(--ink); }
.up-day ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.up-day li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.up-day .ev { display: inline-block; white-space: normal; }
.tag-accepted.mini { margin: 0; padding: 1px 8px 1px 5px; font-size: 11px; }
@media (max-width: 800px) {
    .cal-grid { display: none; }
    .cal-card { padding: 0; }
}

/* "Accepted" tag and the accept button. */
.tag-accepted { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; padding: 3px 10px 3px 7px; border-radius: 20px; background: var(--ok-bg); color: var(--ok); font-size: 12px; font-weight: 600; }
.tag-accepted .i { width: 15px; height: 15px; }
.accept-form { margin: 10px 0 0; }
.btn.accept .i { width: 16px; height: 16px; }

.people { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 14px; }

/* Side panels (drawers). */
.backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(45, 45, 45, .28); opacity: 0; pointer-events: none; transition: opacity .2s; }
body.drawer-open .backdrop { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; z-index: 50; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); display: flex; flex-direction: column; background: var(--card); transform: translateX(105%); visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s; }
.drawer.open { transform: none; visibility: visible; box-shadow: -10px 0 40px rgba(45, 45, 45, .15); transition: transform .25s ease; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.drawer-body { flex: 1; overflow-y: auto; padding: 4px 22px 22px; }
.drawer-actions { display: flex; gap: 10px; margin-top: 22px; }
.drawer-tools { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 22px; border-top: 1px solid var(--line); }
.drawer-tools form { margin: 0; }

/* ---------- Users section ---------- */
table.list { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.list th { padding: 11px 14px; text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--bg); }
table.list td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list td a { color: var(--ink); text-decoration: none; font-weight: 600; }
table.list td a:hover { color: var(--accent); }
table.list tr.off td { color: var(--muted-2); }
table.list .actions { text-align: right; white-space: nowrap; }
table.list .actions form { display: inline; margin-left: 14px; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge.on { background: var(--ok-bg); color: var(--ok); }
.badge.wait { background: var(--panel); color: var(--muted); }
.badge.off { background: var(--late-bg); color: var(--accent); }
a.button.inline { display: inline-flex; width: auto; height: 38px; margin: 0; padding: 0 14px; border-radius: 8px; border-color: var(--ink); background: var(--ink); color: #fff; font: 500 14px/38px var(--font); letter-spacing: 0; text-transform: none; }
a.button.inline:hover { background: #000; }
body.app form > button[type=submit]:not(.btn):not(.link-button):not(.icon-button):not(.as-link):not(.chip-x) {
    display: inline-flex; align-items: center; height: 40px; margin-top: 22px; padding: 0 18px; border: 1px solid var(--ink); border-radius: 8px;
    background: var(--ink); color: #fff; font: 500 14px var(--font); cursor: pointer;
}
body.app main > .card form, body.app main > form { max-width: 560px; }

/* Users: tabs, groups, role pills, project chips. */
.tabs { display: flex; gap: 4px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); text-decoration: none; font-size: 14px; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.user-group { margin-bottom: 26px; }
.group-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.group-head .section-title { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.group-head .section-title a { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.group-head .section-title a:hover { color: var(--accent); }
.user-cell { display: flex; align-items: center; gap: 10px; }
.role { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.role-admin { background: var(--ink); color: #fff; }
.role-manager { background: var(--info-bg); color: var(--info); }
.role-client { background: var(--panel); color: var(--muted); }
.project-chip { display: inline-block; margin: 0 4px 4px 0; padding: 2px 9px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); font-size: 12px; font-weight: 500 !important; text-decoration: none; }
.project-chip:hover { border-color: var(--line-2); }
.card.empty.small { padding: 14px 18px; font-size: 14px; }
.card.empty.small a { color: var(--ink); }

/* Two-factor setup. */
.steps { margin: 18px 0 10px; padding-left: 20px; }
.steps > li { margin-bottom: 22px; }
.steps > li > strong { display: block; margin-bottom: 6px; font-weight: 600; }
.stores { list-style: none; margin: 6px 0 0; padding: 0; font-size: 14px; line-height: 2; }
.stores a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line-2); }
.stores a:hover { color: var(--accent); border-color: var(--accent); }
a.button.secondary-link { display: inline-block; width: auto; height: 40px; margin: 4px 0 18px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: 8px; color: var(--ink); font: 500 14px/38px var(--font); letter-spacing: 0; text-transform: none; }
.qr { display: inline-block; margin: 6px 0 10px; padding: 14px; background: #fff; border-radius: 8px; }
.qr svg { display: block; width: 184px; height: 184px; }
code.secret { word-break: break-all; color: var(--ink); }
.secret-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 14px; border-radius: 8px; background: var(--panel); }
.codes { columns: 2; margin: 14px 0; padding: 18px 20px; list-style: none; border-radius: 8px; background: var(--panel); font-size: 15px; line-height: 1.9; }
details summary { cursor: pointer; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .grid-main-side { grid-template-columns: minmax(0, 1fr); }
    .cards.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
    body.app { display: block; }
    .topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
    .sidebar { position: fixed; z-index: 45; left: 0; top: 0; width: 260px; transform: translateX(-105%); visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s; }
    body.nav-open .sidebar { transform: none; visibility: visible; box-shadow: 10px 0 40px rgba(45, 45, 45, .15); transition: transform .25s ease; }
    .workspace { padding: 20px 16px 50px; }
    .cards, .cards.three { grid-template-columns: minmax(0, 1fr); }
    .feed.compact { grid-template-columns: minmax(0, 1fr); }
    .feed.compact .feed-item:nth-last-child(2):nth-child(odd) { border-bottom: 1px solid var(--line); }
    .stage-item { grid-template-columns: 22px minmax(0, 1fr); }
    .stage-side { grid-column: 2; justify-content: space-between; }
    .two-cols { grid-template-columns: 1fr; gap: 0; }
    .page-title { font-size: 22px; }
    table.list thead { display: none; }
    table.list tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); }
    table.list td { display: block; padding: 3px 0; border: 0; }
    table.list .actions { text-align: left; }
    table.list .actions form { margin: 0 14px 0 0; }
}
@media (max-width: 600px) {
    body.guest h1 { font-size: 26px; }
    body.guest main { margin-top: 6vh; }
    .top { padding: 18px 20px; }
}
