/* Task Manager — plain CSS, no framework */
:root {
    --bg: #f3f5f9;
    --panel: #ffffff;
    --line: #e3e7ee;
    --text: #1d2433;
    --muted: #6b7486;
    --primary: #2f5bea;
    --primary-dark: #2449c4;
    --primary-soft: #eaf0ff;
    --danger: #d64545;
    --radius: 10px;
    --s-open: #3b82f6;
    --s-progress: #f59e0b;
    --s-hold: #8b5cf6;
    --s-done: #16a34a;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, "Nirmala UI", "Noto Sans Tamil", "Noto Sans Arabic", sans-serif;
    font-size: 14px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); display: flex; flex-direction: column; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- Buttons & inputs ---------- */
.btn {
    border: 1px solid transparent; border-radius: 8px; padding: 8px 14px; cursor: pointer;
    background: #fff; transition: background .15s, border-color .15s; white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-light { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.25); }
.btn-light:hover { background: rgba(255,255,255,.24); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { background: #f2f4f8; }
.topbar .btn-ghost { color: #fff; border-color: transparent; }
.topbar .btn-ghost:hover { background: rgba(255,255,255,.14); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-danger { color: var(--danger); border-color: #f2caca; background: #fff; }
.btn-danger:hover { background: #fdf0f0; }
.btn-block { width: 100%; }
.icon-btn { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 2px 6px; border-radius: 6px; }
.icon-btn:hover { background: #eef1f6; color: var(--text); }

input[type=text], input[type=password], input[type=search], input[type=date], input[type=email], input[type=tel], input[type=url], select, textarea {
    width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
textarea { resize: vertical; }
label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
label > input, label > select, label > textarea { margin-top: 4px; color: var(--text); font-size: 14px; }

/* ---------- Top bar ---------- */
.topbar {
    height: 56px; gap: 12px; flex: none; display: flex; align-items: center; justify-content: space-between;
    padding: 0 18px; background: #1b2540; color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; }
.brand-mark {
    width: 28px; height: 28px; border-radius: 8px; background: var(--primary);
    display: grid; place-items: center; font-size: 15px; color: #fff;
}
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.user-menu { position: relative; }
.menu {
    position: absolute; right: 0; top: 42px; background: #fff; color: var(--text); min-width: 180px;
    border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.15); padding: 6px; z-index: 20;
}
.menu a, .menu button {
    display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none;
    border-radius: 6px; color: inherit; text-decoration: none; cursor: pointer;
}
.menu a:hover, .menu button:hover { background: #f2f4f8; }

/* ---------- 3-column board ---------- */
.board {
    flex: 1; min-height: 0; display: grid; gap: 12px; padding: 12px;
    grid-template-columns: minmax(250px, 1fr) minmax(260px, 1fr) minmax(340px, 1.5fr);
}
.col {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.col-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.col-head h2 { font-size: 15px; margin: 0; display: flex; align-items: center; gap: 8px; min-width: 0; }
.col-head h2 span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { background: #eef1f6; color: var(--muted); font-size: 12px; padding: 1px 8px; border-radius: 20px; font-weight: 500; }
.col-filters { display: flex; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.col-filters select { width: 130px; flex: none; }

.list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1; }
.list li.item {
    padding: 10px 12px; border-radius: 8px; cursor: pointer; border: 1px solid transparent;
    border-left: 4px solid var(--s-open); margin-bottom: 6px; background: #fafbfd;
}
.list li.item:hover { background: #f2f5fb; }
.list li.item.active { background: var(--primary-soft); border-color: #c9d6fb; border-left-color: var(--primary); }
.list li.item[data-status="In Progress"] { border-left-color: var(--s-progress); }
.list li.item[data-status="On Hold"] { border-left-color: var(--s-hold); }
.list li.item[data-status="Done"] { border-left-color: var(--s-done); }
.list li.item[data-status="Done"] .item-title { text-decoration: line-through; color: var(--muted); }
.list li.item.active[data-status] { border-left-color: var(--primary); }
.item-title { font-weight: 600; margin-bottom: 5px; word-break: break-word; }
.item-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.progress { height: 4px; background: #e6e9f0; border-radius: 4px; margin-top: 8px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--s-done); }
.empty { color: var(--muted); text-align: center; padding: 32px 16px; list-style: none; }

.pill { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 20px; font-weight: 500; }
.pill-Open { background: #e3eeff; color: #1d4fb8; }
.pill-In-Progress { background: #fff3dc; color: #a15c00; }
.pill-On-Hold { background: #efe7ff; color: #6a3dc9; }
.pill-Done { background: #e1f6e7; color: #137a37; }
.prio-High { color: var(--danger); font-weight: 600; }
.prio-Medium { color: #a15c00; }
.prio-Low { color: var(--muted); }
.overdue { color: var(--danger); font-weight: 600; }

.task-summary { padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfd; font-size: 13px; }
.task-summary .desc { color: var(--muted); margin-top: 4px; white-space: pre-wrap; max-height: 60px; overflow: auto; }
.task-summary .actions { display: flex; gap: 6px; margin-top: 8px; }

/* ---------- Column 3: details ---------- */
.detail { overflow-y: auto; flex: 1; padding: 16px; }
.detail h3 { margin: 0 0 4px; font-size: 18px; word-break: break-word; }
.crumb { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.detail-actions { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 14px 0; }
.fact { background: #fafbfd; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.fact small { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 3px; }
.fact select { padding: 3px 6px; }
.desc-box { white-space: pre-wrap; background: #fafbfd; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 22px 0 10px; display: flex; justify-content: space-between; align-items: center; }

.dropzone {
    border: 2px dashed #cdd5e3; border-radius: 10px; padding: 14px; text-align: center; color: var(--muted);
    cursor: pointer; transition: background .15s, border-color .15s;
}
.dropzone.drag { background: var(--primary-soft); border-color: var(--primary); }
.dropzone small { display: block; margin-top: 4px; font-size: 11.5px; }
.upload-progress { height: 4px; background: #e6e9f0; border-radius: 4px; margin-top: 8px; overflow: hidden; }
.upload-progress i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .1s; }

.files { list-style: none; margin: 10px 0 0; padding: 0; }
.files li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; }
.file-ext { width: 38px; height: 38px; flex: none; border-radius: 8px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 10.5px; font-weight: 700; text-transform: uppercase; }
.file-info { flex: 1; min-width: 0; }
.file-info a { color: var(--text); font-weight: 500; text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-info a:hover { color: var(--primary); }
.file-info small { color: var(--muted); font-size: 11.5px; }

.comments { list-style: none; margin: 0; padding: 0; }
.comments li { display: flex; gap: 10px; margin-bottom: 14px; }
.avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; background: #1b2540; color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.bubble { flex: 1; min-width: 0; background: #f6f8fb; border-radius: 10px; padding: 8px 12px; }
.bubble header { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.bubble header b { color: var(--text); }
.bubble p { margin: 0; white-space: pre-wrap; word-break: break-word; }
.comment-form { background: #fff; padding: 4px 0 14px; margin-bottom: 12px; border-bottom: 1px solid var(--line); border-radius: 8px; }
.comment-form.drag textarea, .edit-form.drag textarea { outline: 2px dashed var(--primary); background: var(--primary-soft); }
.comment-form textarea { min-height: 60px; }
.comment-form .row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 12px; color: var(--muted); }

/* ---------- Dialogs ---------- */
dialog { border: 0; border-radius: 12px; padding: 22px; width: min(520px, 94vw); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20,28,48,.45); }
dialog h3 { margin: 0 0 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; }
.quick-ranges { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 14px; }
.quick-ranges button { border: 1px solid var(--line); background: #fafbfd; border-radius: 20px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.quick-ranges button:hover { border-color: var(--primary); color: var(--primary); }
#itemDialog:not(.is-sub) .only-sub { display: none; }

.toast {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1b2540; color: #fff;
    padding: 10px 18px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 50; max-width: 90vw;
}
.toast.error { background: var(--danger); }

/* ---------- Login ---------- */
.login-page { display: grid; place-items: center; background: linear-gradient(135deg, #1b2540, #2f5bea); }
.login-card { background: #fff; width: min(380px, 92vw); padding: 30px; border-radius: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-card .brand { color: var(--text); font-size: 20px; }
.login-card .muted { color: var(--muted); margin: 6px 0 20px; }
.alert { background: #fdecec; color: #a12d2d; border-radius: 8px; padding: 9px 12px; margin-bottom: 14px; font-size: 13px; }

/* ---------- Responsive: tablets ---------- */
.col-tabs { display: none; }
@media (max-width: 1100px) {
    .board { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
    #col3 { grid-column: 1 / -1; }
}
/* ---------- Phones: one column at a time ---------- */
@media (max-width: 720px) {
    .topbar { padding: 0 10px; }
    .brand { font-size: 15px; }
    .col-tabs { display: flex; background: #fff; border-bottom: 1px solid var(--line); flex: none; }
    .col-tabs button { flex: 1; border: 0; background: none; padding: 11px 0; border-bottom: 2px solid transparent; cursor: pointer; color: var(--muted); }
    .col-tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
    .board { display: block; padding: 8px; overflow: hidden; }
    .board .col { height: 100%; display: none; }
    .board[data-active="1"] #col1, .board[data-active="2"] #col2, .board[data-active="3"] #col3 { display: flex; }
    .grid-2 { grid-template-columns: 1fr; }
}


/* =====================================================================
 * v2 additions: projects, nav, comments, history, bookmarks, report, account
 * ===================================================================== */
a.brand { color: inherit; text-decoration: none; }
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.project-filter {
    width: auto; max-width: 220px; background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.25);
    padding: 6px 10px; font-weight: 500;
}
.project-filter option { color: var(--text); }
.main-nav { display: flex; gap: 4px; flex: 1; justify-content: center; }
.main-nav a {
    color: rgba(255,255,255,.75); text-decoration: none; padding: 7px 12px; border-radius: 8px; display: flex; gap: 6px; align-items: center;
}
.main-nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.main-nav a.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }

.proj-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.proj-chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.task-summary .proj-chip { margin-bottom: 6px; }
.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 20px; background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.tag-muted { background: #eef1f6; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.btn-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 22px 0 12px; }
.tabs button {
    border: 0; background: none; padding: 9px 14px; cursor: pointer; color: var(--muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

/* comments */
.comment-form .row { flex-wrap: wrap; gap: 8px; }
.work-fields { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.work-fields input { width: auto; padding: 5px 8px; font-size: 13px; }
.work-fields .time-input { width: 150px; }
.pending-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pending-files:empty { display: none; }
.pending-chip {
    display: inline-flex; align-items: center; gap: 6px; background: var(--primary-soft); border-radius: 8px;
    padding: 3px 4px 3px 6px; font-size: 12px; max-width: 240px;
}
.pending-chip img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; }
.pending-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.time-badge { background: #e1f6e7; color: #137a37; border-radius: 20px; padding: 0 8px; font-size: 11.5px; font-weight: 600; white-space: nowrap; margin-right: 4px; }
.edited { font-style: normal; color: var(--muted); font-size: 11px; }
.c-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.c-thumb img { max-width: 160px; max-height: 110px; border-radius: 6px; border: 1px solid var(--line); display: block; background: #fff; }
.c-file { font-size: 12.5px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; color: var(--text); text-decoration: none; }
.c-file:hover { border-color: var(--primary); color: var(--primary); }
.c-file small { color: var(--muted); }
.edit-form textarea { min-height: 70px; margin-bottom: 6px; }
.edit-form .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.comments li.editing .bubble { background: #fff; border: 1px solid #c9d6fb; }

/* history */
.history { list-style: none; margin: 0; padding: 0; }
.history > li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.h-ico { width: 26px; flex: none; text-align: center; }
.h-main { flex: 1; min-width: 0; word-break: break-word; }
.h-main small { color: var(--muted); font-size: 11.5px; }
.h-where { display: inline-block; margin-left: 6px; font-size: 11.5px; color: var(--muted); background: #eef1f6; border-radius: 4px; padding: 0 6px; }
.h-changes { list-style: none; margin: 4px 0; padding: 6px 10px; background: #fafbfd; border-radius: 6px; font-size: 12.5px; }
.h-changes del { color: #a12d2d; }
.h-changes ins { color: #137a37; text-decoration: none; }
.dialog-wide { width: min(720px, 96vw); }
.history-scroll { max-height: 65vh; overflow-y: auto; }

/* generic pages (bookmarks, report, account) */
.page { flex: 1; overflow-y: auto; padding: 18px 22px 40px; width: 100%; max-width: 1280px; margin: 0 auto; }
.page-narrow { max-width: 900px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { font-size: 22px; margin: 0; display: flex; gap: 8px; align-items: center; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type=search] { flex: 1; min-width: 200px; }
.toolbar select { width: auto; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.form-narrow { max-width: 440px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head p { margin: 0; }
.check-label { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13.5px; align-self: end; padding-bottom: 8px; }
.check-label input { width: auto; margin: 0; }

/* bookmarks */
.bm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.bm-grid > .empty { grid-column: 1 / -1; }
.bm-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.bm-card:hover { border-color: #c9d6fb; box-shadow: 0 4px 14px rgba(29,36,51,.06); }
.bm-top { display: flex; gap: 10px; align-items: center; min-width: 0; }
.bm-ico { width: 36px; height: 36px; flex: none; border-radius: 9px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 700; }
.bm-main { min-width: 0; }
.bm-title { font-weight: 600; color: var(--text); text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-title:hover { color: var(--primary); text-decoration: underline; }
.bm-host { color: var(--muted); font-size: 12px; }
.bm-note { margin: 0; font-size: 13px; color: #3d4659; white-space: pre-wrap; word-break: break-word; }
.bm-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: auto; }
.bm-foot .proj-chip { margin: 0; }
.bm-actions { display: flex; flex: none; }

/* report */
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 4px; }
.filters .quick-ranges { grid-column: 1 / -1; margin: 0 0 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 14px 0 0; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.stat small { display: block; color: var(--muted); font-size: 12px; }
.stat b { font-size: 20px; }
.page-tabs { margin-top: 18px; }
.day { margin-bottom: 18px; }
.day-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.day-head h3 { margin: 0; font-size: 15px; }
.day-total { font-weight: 700; color: #137a37; background: #e1f6e7; border-radius: 20px; padding: 2px 12px; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; background: #fafbfd; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; word-break: break-word; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid .num { text-align: right; white-space: nowrap; }
table.grid tr.day-row td { background: #f3f5f9; font-weight: 600; }
table.grid tr.inactive td { color: var(--muted); }
table.grid select { width: auto; padding: 3px 6px; }
.cell-list { margin: 0; padding-left: 16px; }
.cell-list li { margin-bottom: 2px; white-space: pre-wrap; }
.report-body .empty { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }

/* account / projects */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.proj-card { background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--pc, var(--primary)); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.proj-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.proj-card h3 { margin: 0; font-size: 15px; word-break: break-word; }
.proj-card p { margin: 0; font-size: 13px; white-space: pre-wrap; }
.proj-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.swatches { display: flex; gap: 8px; margin: -6px 0 12px; }
.swatch { margin: 0; cursor: pointer; }
.swatch input { display: none; }
.swatch i { display: block; width: 26px; height: 26px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.swatch input:checked + i { box-shadow: 0 0 0 2px var(--text); }
.member-list { list-style: none; margin: 0 0 12px; padding: 0; max-height: 50vh; overflow-y: auto; }
.member-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.m-info { flex: 1; min-width: 0; }
.m-info b, .m-info small { display: block; overflow: hidden; text-overflow: ellipsis; }
.m-info small { color: var(--muted); font-size: 12px; }
.add-member { display: flex; gap: 8px; }
.switch { display: inline-block; margin: 0; cursor: pointer; }
.switch input { display: none; }
.switch i { display: block; width: 36px; height: 20px; border-radius: 20px; background: #cdd5e3; position: relative; transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch input:checked + i { background: var(--s-done); }
.switch input:checked + i::after { left: 18px; }
.switch input:disabled + i { opacity: .5; }

/* auth pages */
.login-card-wide { width: min(480px, 94vw); }
.login-page input[type=email], .login-page input[type=tel] { margin-top: 4px; }
.auth-switch { text-align: center; margin: 16px 0 0; font-size: 13px; color: var(--muted); }
.auth-switch a { color: var(--primary); font-weight: 600; }
.alert-ok { background: #e1f6e7; color: #137a37; }
.setup-steps { font-size: 13px; padding-left: 18px; color: #3d4659; }
.setup-steps li.err { color: var(--danger); }

@media (max-width: 1100px) {
    .nav-label { display: none; }
    .topbar-actions .btn-ghost .nav-label { display: none; }
}
@media (max-width: 720px) {
    .project-filter { max-width: 130px; }
    .brand-text { display: none; }
    .main-nav { justify-content: flex-end; }
    .main-nav a { padding: 7px 9px; }
    .page { padding: 12px; }
    .work-fields .time-input { width: 120px; }
}

/* =====================================================================
 * v3: Credentials (Markdown documents)
 * ===================================================================== */
.cred-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 290px 1fr; gap: 12px; padding: 12px; }
.cred-side, .cred-main { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); min-height: 0; }
.cred-side { display: flex; flex-direction: column; padding: 12px; gap: 10px; }
.cred-side-head { display: flex; justify-content: space-between; align-items: center; }
.cred-side-head h1 { font-size: 17px; margin: 0; }
.doc-tree { flex: 1; overflow-y: auto; margin: 0 -6px; }
.doc-group { margin-bottom: 10px; }
.doc-group-head { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 6px 8px; }
.doc-group-head span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-group-head small { font-weight: 600; background: #eef1f6; border-radius: 10px; padding: 0 7px; }
.doc-group-head .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.doc-link { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; padding: 7px 10px 7px 22px; border-radius: 7px; color: var(--text); text-decoration: none; font-size: 13.5px; }
.doc-link:hover { background: #f2f5fb; }
.doc-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.doc-link-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-link small { color: var(--muted); font-size: 11px; font-weight: 400; flex: none; }
.cred-note { font-size: 11.5px; color: var(--muted); margin: 0; border-top: 1px solid var(--line); padding-top: 8px; }

.cred-main { display: flex; flex-direction: column; overflow: hidden; }
.cred-empty { margin: auto; max-width: 520px; }
.cred-empty-ico { font-size: 44px; }
.cred-empty h2 { font-size: 18px; color: var(--text); margin: 8px 0; }
.cred-empty code { background: #eef1f6; padding: 1px 5px; border-radius: 4px; color: var(--text); }
.doc-view, .doc-edit { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.doc-view[hidden], .doc-edit[hidden] { display: none; }
.doc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fafbfd; }
.doc-title-wrap { flex: 1; min-width: 200px; }
.doc-file { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 600; font-size: 14.5px; word-break: break-all; }
.doc-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); margin-top: 3px; }
.doc-meta .proj-chip { margin: 0; }
.doc-back { display: none; }
.doc-title-input { flex: 1; min-width: 200px; font-weight: 600; font-size: 15px !important; }
.doc-project { width: auto !important; max-width: 240px; }
.kbd { opacity: .7; font-size: 10.5px; margin-left: 4px; }
.doc-view .md-paper { flex: 1; overflow-y: auto; }

.md-toolbar { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.md-toolbar > button { border: 0; background: none; min-width: 32px; height: 30px; border-radius: 6px; cursor: pointer; color: #3d4659; font-size: 13px; padding: 0 8px; }
.md-toolbar > button:hover { background: #eef1f6; }
.md-tabs { margin-left: auto; display: inline-flex; background: #eef1f6; border-radius: 8px; padding: 2px; }
.md-tabs button { border: 0; background: none; padding: 4px 12px; border-radius: 6px; cursor: pointer; font-size: 12.5px; color: var(--muted); }
.md-tabs button.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.md-split { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; }
.md-split[data-pane="write"] { grid-template-columns: 1fr; }
.md-split[data-pane="write"] .md-preview { display: none; }
.md-split[data-pane="preview"] { grid-template-columns: 1fr; }
.md-split[data-pane="preview"] textarea { display: none; }
.md-split textarea {
    border: 0; border-radius: 0; border-right: 1px solid var(--line); resize: none; height: 100%; padding: 16px 18px;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace; font-size: 13.5px; line-height: 1.6; background: #fcfcfe;
}
.md-split textarea:focus { outline: none; background: #fff; }
.md-preview { overflow-y: auto; }
.doc-edit .form-error { padding: 0 16px; }

/* Rendered Markdown — document look */
.md-paper { background: #fff; }
.md-body { max-width: 900px; margin: 0 auto; padding: 22px 32px 40px; line-height: 1.65; font-size: 14.5px; color: #1f2430; word-wrap: break-word; }
.md-body > :first-child { margin-top: 0; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { line-height: 1.3; margin: 1.4em 0 .6em; font-weight: 650; }
.md-body h1 { font-size: 1.85em; padding-bottom: .3em; border-bottom: 1px solid var(--line); }
.md-body h2 { font-size: 1.4em; padding-bottom: .25em; border-bottom: 1px solid #eef1f6; }
.md-body h3 { font-size: 1.15em; }
.md-body p, .md-body ul, .md-body ol, .md-body table, .md-body pre, .md-body blockquote { margin: 0 0 1em; }
.md-body ul, .md-body ol { padding-left: 1.6em; }
.md-body li + li { margin-top: .25em; }
.md-body li input[type=checkbox] { margin: 0 .4em 0 -1.3em; vertical-align: middle; }
.md-body ul:has(> li > input[type=checkbox]) { list-style: none; }
.md-body a { color: var(--primary); }
.md-body code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .88em; background: #eff2f7; padding: .15em .4em; border-radius: 5px; }
.md-body pre { position: relative; background: #1b2540; color: #e6ebf5; padding: 14px 16px; border-radius: 9px; overflow-x: auto; }
.md-body pre code { background: none; padding: 0; color: inherit; font-size: 13px; }
.md-body blockquote { border-left: 4px solid #c9d6fb; background: #f6f8fd; padding: 8px 14px; color: #3d4659; border-radius: 0 8px 8px 0; }
.md-body blockquote > :last-child { margin-bottom: 0; }
.md-body table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; }
.md-body th, .md-body td { border: 1px solid var(--line); padding: 7px 12px; text-align: left; vertical-align: top; }
.md-body th { background: #f6f8fb; font-weight: 600; }
.md-body tr:nth-child(2n) td { background: #fbfcfe; }
.md-body hr { border: 0; border-top: 1px solid var(--line); margin: 1.6em 0; }
.md-body img { max-width: 100%; border-radius: 6px; }
.code-copy { position: absolute; top: 8px; right: 8px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: #e6ebf5; font-size: 11.5px; border-radius: 6px; padding: 2px 8px; cursor: pointer; opacity: 0; transition: opacity .15s; }
.md-body pre:hover .code-copy { opacity: 1; }
.secret { display: inline-flex; align-items: center; gap: 2px; background: #fff7e6; border: 1px solid #f5dfae; border-radius: 6px; padding: 0 2px 0 8px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .88em; vertical-align: baseline; }
.secret.shown { background: #fff; border-color: var(--primary); }
.secret-text { letter-spacing: .05em; user-select: all; }
.secret-btn { border: 0; background: none; cursor: pointer; padding: 1px 4px; border-radius: 4px; font-size: 12px; line-height: 1.4; }
.secret-btn:hover { background: rgba(0,0,0,.06); }

/* Versions dialog */
.versions { display: grid; grid-template-columns: 230px 1fr; gap: 12px; height: min(60vh, 560px); }
.version-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; border-right: 1px solid var(--line); padding-right: 8px; }
.version-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.version-list button:hover { background: #f2f5fb; }
.version-list button.active { background: var(--primary-soft); }
.version-list small { display: block; color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.version-preview { overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.version-preview .md-body { padding: 16px 20px; font-size: 13.5px; }

@media (max-width: 900px) {
    .cred-layout { grid-template-columns: 1fr; }
    .cred-layout[data-view="doc"] .cred-side { display: none; }
    .cred-layout[data-view="list"] .cred-main { display: none; }
    .doc-back { display: inline-block; }
    .md-split { grid-template-columns: 1fr; }
    .md-split[data-pane="split"] .md-preview { display: none; }
    .md-body { padding: 16px; }
    .versions { grid-template-columns: 1fr; height: auto; }
    .version-list { max-height: 160px; border-right: 0; }
    .version-preview { max-height: 45vh; }
}
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
