* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* Funte brand palette */
    --purple:  #5C4BC8;
    --orange:  #F5912C;
    --coral:   #EF5B6A;
    --teal:    #5AB8C8;
    --green:   #2DAB65;

    /* App tokens */
    --bg:      #FAF8FF;
    --surface: #ffffff;
    --border:  #E8E4F0;
    --text:    #1a1a2e;
    --muted:   #8888aa;
    --red:     #d63f3f;
    --grey:    #ccc;
    --accent:  var(--purple);
    --radius:  10px;
    --font:    'Helvetica Neue', Arial, sans-serif;
}

body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5; }

/* ── Header ── */
header { background: #fff; border-bottom: 4px solid var(--accent); padding: 0 32px; height: 56px; display: flex; align-items: center; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-img { height: 34px; }
.logo-text { color: var(--accent); font-size: 20px; font-weight: 700; letter-spacing: 0.06em; }

main { max-width: 1280px; margin: 0 auto; padding: 36px 24px; }

/* ── Page header ── */
.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; flex-wrap: wrap; }
.page-header h1 { font-size: 21px; font-weight: 600; }
.header-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; }
.header-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.back-link { color: var(--muted); text-decoration: none; font-size: 14px; white-space: nowrap; }
.back-link:hover { color: var(--text); }

/* ── Buttons ── */
.btn-primary { background: var(--accent); color: #fff; border: none; padding: 9px 18px; border-radius: var(--radius); font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; display: inline-block; }
.btn-primary:hover { opacity: 0.88; }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border); padding: 9px 18px; border-radius: var(--radius); font-size: 14px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn-ghost { background: none; border: 1px solid var(--border); color: var(--muted); padding: 6px 14px; border-radius: var(--radius); font-size: 13px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn-ghost:hover { border-color: #aaa; color: var(--text); }
.btn-mark { background: var(--accent); color: #fff; border: none; padding: 4px 10px; border-radius: 6px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.undo-btn { background: none; border: none; color: var(--muted); font-size: 11px; cursor: pointer; text-decoration: underline; padding: 0; }
.input-disabled { background: #f0eee9; color: var(--muted); border: 1px solid var(--border); border-radius: 7px; padding: 9px 12px; font-size: 14px; width: 100%; }
.muted-date { color: var(--muted); text-decoration: line-through; font-size: 12px; }
.modified-date { color: var(--orange); }
.date-col-spacer { width: 48px; }

/* ── Tags / pills ── */
.tag-neutral { font-size: 12px; background: #f0eee9; color: #555; padding: 3px 9px; border-radius: 20px; }
.rush-tag { font-size: 12px; background: #fff3e8; color: var(--orange); padding: 3px 9px; border-radius: 20px; font-weight: 600; }
.label-hint { font-weight: 400; color: var(--muted); }
.project-num-tag { font-size: 11px; background: #EEEAF8; color: var(--accent); padding: 2px 8px; border-radius: 20px; font-weight: 600; letter-spacing: 0.04em; }

/* ── Package color tags ── */
.pkg-tag { font-size: 12px; padding: 3px 9px; border-radius: 20px; font-weight: 500; white-space: nowrap; }
.pkg-signature { background: #FFF0E2; color: #C06A10; }
.pkg-premium   { background: #EEEAF8; color: #4535A0; }
.pkg-custom    { background: #E8F0FE; color: #1A56C4; }

/* ── Project type color tags ── */
.type-tag { font-size: 12px; padding: 3px 9px; border-radius: 20px; font-weight: 500; white-space: nowrap; }
.type-residential { background: #E6F7FA; color: #2E7E8A; }
.type-commercial  { background: #FEF0F1; color: #B8283A; }

/* ── Stage pills ── */
.stage-pill { font-size: 12px; padding: 3px 9px; border-radius: 20px; font-weight: 500; }
.stage-pre-start  { background: #f0eee9; color: #777; }
.stage-active     { background: #e6f4ee; color: var(--green); }
.stage-completed  { background: #EEEAF8; color: var(--accent); }
.stage-closed     { background: #eee; color: #999; }

/* ── Status pills ── */
.status-pill { font-size: 12px; padding: 3px 10px; border-radius: 20px; font-weight: 500; white-space: nowrap; }
.status-not-started    { background: #f0eee9; color: #888; }
.status-on-time        { background: #e6f4ee; color: var(--green); }
.status-waiting-client { background: #fff7e6; color: var(--orange); }
.status-delayed        { background: #fdf0f0; color: var(--red); }
.status-delayed-funte  { background: #fdf0f0; color: var(--red); border: 1.5px solid var(--red); }
.status-delayed-client { background: #fdf0f0; color: #a02020; border: 1.5px solid #a02020; font-weight: 700; }

/* ── Project table ── */
.project-table { width: 100%; border-collapse: collapse; table-layout: fixed; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.project-table col.c-rush    { width: 36px; }
.project-table col.c-num     { width: 90px; }
.project-table col.c-project { width: 130px; }
.project-table col.c-client  { width: 100px; }
.project-table col.c-package { width: 100px; }
.project-table col.c-type    { width: 90px; }
.project-table col.c-room    { width: 70px; }
.project-table col.c-phase   { width: auto; }
.project-table col.c-due     { width: 68px; }
.project-table col.c-progress{ width: 130px; }
.project-table col.c-lead    { width: 100px; }
.project-table thead tr { background: #F3F0FB; border-bottom: 1px solid var(--border); }
.project-table th { text-align: left; padding: 10px 14px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.project-table td { padding: 12px 14px; font-size: 14px; border-bottom: 1px solid #EEE9F8; }
.project-row:last-child td { border-bottom: none; }
.project-row:hover td { background: #F7F5FD; }
.row-closed td { color: var(--muted); }
.rush-cell { width: 28px; padding-right: 0; }
.rush-pip { font-size: 14px; }
.client-cell { font-weight: 500; }

/* ── Project number ── */
.project-num-cell { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ── Sub-table headers ── */
.sub-table-header { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.07em; margin: 28px 0 8px; padding-left: 2px; }
.sub-table-header--dark { color: var(--text); }

.empty-state { text-align: center; padding: 80px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 16px; }

/* ── Form ── */
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; max-width: 600px; display: flex; flex-direction: column; gap: 20px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row-group { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row label { font-size: 13px; font-weight: 600; color: #444; }
.form-row input[type="text"], .form-row input[type="date"], .form-row select, .form-row textarea { border: 1px solid var(--border); border-radius: 7px; padding: 9px 12px; font-size: 14px; font-family: var(--font); background: var(--bg); color: var(--text); outline: none; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--accent); }
.form-row-check label { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: 14px; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 8px; }

/* ── Detail layout ── */
.detail-grid { display: grid; grid-template-columns: 340px 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 780px) { .detail-grid { grid-template-columns: 1fr; } }

/* ── Card ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.card h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); margin-bottom: 4px; }
.card-sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.notes-card { margin-top: 0; }
.notes-card p { font-size: 14px; color: #555; margin-top: 8px; }

/* ── Checklist ── */
.checklist { list-style: none; display: flex; flex-direction: column; gap: 2px; margin-bottom: 16px; }
.check-item { display: flex; align-items: center; gap: 8px; border-radius: 7px; padding: 2px 0; }
.check-toggle-form { flex: 1; }
.check-btn { display: flex; align-items: center; gap: 10px; background: none; border: none; cursor: pointer; padding: 7px 6px; border-radius: 7px; font-size: 14px; color: var(--text); text-align: left; }
.check-btn:hover { background: var(--bg); }
.check-box { width: 20px; height: 20px; border: 2px solid var(--border); border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; color: var(--green); font-weight: 700; }
.checked .check-box { border-color: var(--green); background: #e6f4ee; }
.checked .check-label { color: var(--muted); text-decoration: line-through; }
.date-edit-form { margin-left: auto; }

.badge-success { padding: 8px 12px; background: #e6f4ee; color: var(--green); border-radius: 7px; font-size: 13px; font-weight: 500; }
.badge-pending { padding: 8px 12px; background: #F3F0FB; color: var(--muted); border-radius: 7px; font-size: 13px; }

/* ── Status dot ── */
.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-green    { background: var(--green); }
.status-orange   { background: var(--orange); }
.status-red      { background: var(--red); }
.status-grey, .status-pending { background: var(--grey); }
.status-complete { background: var(--green); opacity: 0.35; }

/* ── Milestone list ── */
.milestone-list { display: flex; flex-direction: column; }

.milestone-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px; border-radius: 7px; gap: 10px; flex-wrap: wrap; }
.milestone-row:hover { background: var(--bg); }
.status-bg-red { background: #fff5f5 !important; }
.status-bg-red:hover { background: #feeaea !important; }

.milestone-left { display: flex; align-items: center; gap: 10px; min-width: 140px; flex: 1; min-width: 0; }
.milestone-info { display: flex; flex-direction: column; }
.milestone-name { font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.milestone-owner { font-size: 12px; color: var(--muted); }

.custom-tag { font-size: 10px; background: #EEEAF8; color: var(--accent); padding: 1px 6px; border-radius: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.locked-tag { font-size: 9px; background: #E6F7FA; color: #2E7E8A; padding: 1px 5px; border-radius: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; margin-left: 3px; vertical-align: middle; }

.milestone-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; flex-shrink: 0; }
.date-col { display: flex; flex-direction: column; align-items: flex-end; }
.date-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.date-val { font-size: 13px; font-weight: 500; }
.date-val.actual { color: var(--green); }
.pending-label { font-size: 12px; color: var(--muted); font-style: italic; }

.inline-date-form { display: flex; align-items: center; gap: 6px; }
.date-input-small { border: 1px solid var(--border); border-radius: 6px; padding: 4px 7px; font-size: 12px; background: var(--bg); color: var(--text); outline: none; }

/* ── Insert milestone ── */
.insert-row { display: flex; align-items: center; gap: 8px; padding: 0 8px; margin: 2px 0; min-height: 28px; }
.insert-toggle { background: none; border: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 3px 6px; border-radius: 5px; }
.insert-toggle:hover { background: var(--bg); color: var(--text); }
.insert-form { display: none; align-items: center; gap: 8px; flex-wrap: wrap; }
.insert-row.open .insert-toggle { display: none; }
.insert-row.open .insert-form { display: flex; }
.insert-input { border: 1px solid var(--border); border-radius: 6px; padding: 4px 9px; font-size: 13px; background: var(--bg); outline: none; width: 180px; }
.insert-select { border: 1px solid var(--border); border-radius: 6px; padding: 4px 7px; font-size: 13px; background: var(--bg); outline: none; }
.insert-bd { border: 1px solid var(--border); border-radius: 6px; padding: 4px 7px; font-size: 13px; background: var(--bg); outline: none; width: 60px; }

/* ── Planned date override ── */
.plan-edit-form { display: none; }
.plan-edit-form.open { display: inline-flex; align-items: center; }

/* ── Phase cell ── */
.phase-cell { font-size: 13px; color: #555; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due-cell { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* ── Phase action buttons ── */
.delete-phase-btn { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 0 4px; line-height: 1; border-radius: 4px; }
.delete-phase-btn:hover { color: var(--red); background: #fdf0f0; }
.dupe-phase-btn { background: none; border: none; color: var(--muted); font-size: 14px; cursor: pointer; padding: 0 4px; line-height: 1; border-radius: 4px; }
.dupe-phase-btn:hover { color: var(--accent); background: #EEEAF8; }

/* ── Inline rename ── */
.rename-form { display: none; }
.rename-form.open { display: inline-flex; }
.rename-input { border: 1px solid var(--accent); border-radius: 5px; padding: 2px 7px; font-size: 13px; font-weight: 500; font-family: var(--font); background: var(--bg); color: var(--text); outline: none; width: 200px; }

/* ── Change log ── */
.changelog-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.changelog-entry { display: flex; gap: 14px; align-items: baseline; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.changelog-entry:last-child { border-bottom: none; }
.changelog-date { font-size: 11px; color: var(--muted); white-space: nowrap; min-width: 80px; }
.changelog-text { color: #444; line-height: 1.5; }
.log-late  { color: var(--red); font-weight: 500; }
.log-early { color: var(--green); font-weight: 500; }

/* ── Header nav / user ── */
.header-nav { display: flex; align-items: center; gap: 4px; margin-left: 24px; }
.nav-link { font-size: 13px; color: var(--muted); text-decoration: none; padding: 5px 10px; border-radius: var(--radius); }
.nav-link:hover { color: var(--text); background: var(--bg); }
.header-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.header-user-name { font-size: 13px; color: var(--muted); }

/* ── Auth forms ── */
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form input, .auth-form select { border: 1px solid var(--border); border-radius: 7px; padding: 9px 12px; font-size: 14px; font-family: var(--font); background: var(--bg); color: var(--text); outline: none; width: 100%; }
.auth-form input:focus, .auth-form select:focus { border-color: var(--accent); }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 4px; display: block; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 48px; width: 100%; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--muted); font-size: 13px; padding: 0; line-height: 1; }
.pw-toggle:hover { color: var(--text); }
.alert-error   { background: #fdf0f0; color: var(--red); border: 1px solid #f5c6c6; border-radius: 7px; padding: 10px 14px; font-size: 13px; margin-bottom: 12px; }
.alert-success { background: #e6f4ee; color: var(--green); border: 1px solid #b3dfc7; border-radius: 7px; padding: 10px 14px; font-size: 13px; margin-bottom: 12px; }

/* ── View toggle ── */
.view-toggle { background: none; border: 1px solid var(--border); color: var(--muted); padding: 6px 13px; border-radius: var(--radius); font-size: 13px; cursor: pointer; }
.view-toggle:hover { border-color: #aaa; color: var(--text); }
.view-toggle.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Gantt ── */
.gantt-wrap { overflow-x: auto; }
.gantt-inner { min-width: 700px; }
.gantt-header-row { display: flex; margin-bottom: 6px; }
.gantt-label-col { flex-shrink: 0; }
.gantt-axis { flex: 1; position: relative; height: 22px; border-bottom: 1px solid var(--border); }
.gantt-row { display: flex; align-items: center; border-bottom: 1px solid #EEE9F8; }
.gantt-row:last-child { border-bottom: none; }
.gantt-row-label { flex-shrink: 0; padding-right: 14px; overflow: hidden; cursor: pointer; }
.gantt-row-label:hover .gantt-proj-name { color: var(--accent); }
.gantt-proj-num  { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-proj-name { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-chart-area { flex: 1; position: relative; }
.gantt-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); }
.gantt-legend-item { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.gantt-legend-swatch { width: 14px; height: 12px; border-radius: 3px; display: inline-block; flex-shrink: 0; }

/* ── Tasks ── */
.tasks-section { margin-bottom: 32px; }
.tasks-section-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.task-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 8px; }
.task-card:last-child { margin-bottom: 0; }
.task-card-left { flex: 1; min-width: 0; }
.task-card-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.task-project { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.task-phase { font-size: 14px; font-weight: 500; color: var(--text); }
.task-due { font-size: 12px; color: var(--muted); white-space: nowrap; }
.task-due-overdue { color: var(--coral); font-weight: 600; }
.task-denial-note { font-size: 12px; color: var(--coral); margin-top: 4px; font-style: italic; }
.task-overdue { border-left: 3px solid var(--coral); }
.task-pending { border-left: 3px solid #C5BCEE; opacity: .85; }
.task-denied  { border-left: 3px solid var(--coral); background: #FFF8F7; }
.review-badge { display: inline-flex; align-items: center; justify-content: center; background: var(--coral); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; min-width: 20px; height: 20px; padding: 0 6px; }
.nav-link-active { color: var(--accent) !important; font-weight: 600; }
.deny-form { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }

/* Settings page */
.notify-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.notify-row:last-child { border-bottom: none; }
.notify-label { font-size: 14px; font-weight: 500; margin-bottom: 2px; }
.notify-desc { font-size: 12px; color: var(--muted); }
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--border); border-radius: 22px; transition: background 0.2s; }
.toggle-slider:before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform 0.2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(18px); }
