:root {
  --blue: #4fa3d1;
  --blue-dark: #1f4e79;
  --blue-soft: #eaf5fb;
  --green: #6bc46d;
  --green-dark: #3f9746;
  --green-soft: #edf8ed;
  --ink: #1d3445;
  --text: #4a4a4a;
  --muted: #6e7e89;
  --line: #e1e9ee;
  --surface: #ffffff;
  --canvas: #f5f8fa;
  --danger: #c64747;
  --danger-soft: #fff0f0;
  --warning: #a66b13;
  --warning-soft: #fff7e8;
  --shadow: 0 16px 42px rgba(31, 78, 121, .08);
  --radius: 18px;
}
* { box-sizing: border-box; }
html { font-family: Inter, Montserrat, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: var(--canvas); font-size: 16px; }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
.skip-link { position: fixed; top: -60px; left: 1rem; z-index: 100; background: var(--blue-dark); color: #fff; padding: .75rem 1rem; border-radius: 8px; }
.skip-link:focus { top: 1rem; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--line); padding: 1.8rem 1rem 1.2rem; display: flex; flex-direction: column; z-index: 30; }
.brand { display: block; padding: .25rem .7rem 1.5rem; }
.brand img { width: 145px; height: 92px; object-fit: contain; object-position: left center; }
.nav { display: flex; flex-direction: column; gap: .25rem; }
.nav a { text-decoration: none; display: flex; align-items: center; gap: .7rem; min-height: 44px; padding: .7rem .85rem; border-radius: 11px; color: #536672; font-weight: 600; font-size: .92rem; }
.nav a:hover { background: var(--blue-soft); color: var(--blue-dark); }
.nav a.active { color: var(--blue-dark); background: linear-gradient(100deg, rgba(79,163,209,.17), rgba(107,196,109,.09)); box-shadow: inset 3px 0 var(--blue); }
.nav-icon { width: 1.35rem; color: var(--blue); text-align: center; font-size: 1.15rem; }
.nav-label { margin: 1.15rem .85rem .35rem; text-transform: uppercase; color: #9aa7af; font-size: .68rem; letter-spacing: .12em; font-weight: 800; }
.sidebar-user { margin-top: auto; padding: 1rem .5rem 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: .65rem; min-width: 0; }
.avatar { width: 38px; height: 38px; flex: 0 0 auto; border-radius: 50%; background: linear-gradient(145deg, var(--blue), #48c3cc); color: white; display: inline-grid; place-items: center; font-weight: 800; }
.avatar-small { width: 30px; height: 30px; font-size: .8rem; }
.sidebar-user-copy { min-width: 0; display: grid; line-height: 1.25; }
.sidebar-user-copy strong { color: var(--ink); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-copy span { color: var(--muted); font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workspace { min-width: 0; }
.topbar { height: 70px; background: rgba(255,255,255,.91); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 2.2rem; position: sticky; top: 0; z-index: 20; }
.topbar-title { color: var(--blue-dark); font-size: .84rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.topbar-actions { display: flex; align-items: center; gap: 1rem; }
.topbar-actions form { margin: 0; }
.menu-button { display: none; border: 0; background: transparent; color: var(--blue-dark); font-size: 1.45rem; }
.main-content { max-width: 1450px; margin: 0 auto; padding: 2.3rem; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; margin-bottom: 1.75rem; }
.page-heading h1 { margin: .15rem 0 .35rem; color: var(--ink); font-size: clamp(1.85rem, 3vw, 2.6rem); letter-spacing: -.035em; line-height: 1.1; }
.page-heading p:not(.overline) { margin: 0; color: var(--muted); max-width: 780px; line-height: 1.55; }
.overline { color: var(--blue); text-transform: uppercase; font-weight: 800; letter-spacing: .14em; font-size: .72rem; margin: 0; }
.live-time { font-size: 2rem; color: var(--blue-dark); font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: .04em; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(250px, .7fr); gap: 1.35rem; margin-bottom: 1.35rem; }
.clock-card, .metric-card, .section-card, .form-card, .project-profit-card, .kpi-grid article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.clock-card { min-height: 305px; padding: 2rem; position: relative; overflow: hidden; }
.clock-card::after { content: ""; position: absolute; width: 280px; height: 280px; right: -110px; top: -125px; border-radius: 50%; border: 34px solid rgba(79,163,209,.08); box-shadow: 0 0 0 28px rgba(107,196,109,.05); }
.clock-card-head { display: flex; align-items: center; gap: .55rem; color: var(--muted); font-weight: 700; position: relative; z-index: 1; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #b7c2c8; }
.status-dot.is-live { background: var(--green); box-shadow: 0 0 0 6px rgba(107,196,109,.15); }
.clock-primary { color: var(--ink); font-size: clamp(3.5rem, 9vw, 6rem); font-weight: 700; letter-spacing: -.05em; line-height: 1; margin-top: 2rem; }
.clock-card .button-large { margin-top: 1.3rem; }
.metric-stack { display: grid; gap: 1.35rem; }
.metric-card { padding: 1.5rem; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.metric-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--blue); }
.metric-card.accent-green::before { background: var(--green); }
.metric-card span { color: var(--muted); font-size: .86rem; font-weight: 700; }
.metric-card strong { color: var(--ink); font-size: 2.35rem; margin: .35rem 0; }
.metric-card small { color: var(--muted); }
.time-pair { display: flex; gap: 3rem; margin-top: 2.5rem; }
.time-pair div { display: grid; gap: .25rem; }
.time-pair span { color: var(--muted); }
.time-pair strong { font-size: 3rem; color: var(--ink); }
.total-time { color: var(--muted); font-weight: 700; }
.completed-mark { color: var(--green-dark); font-weight: 800; margin-top: 1rem; }
.section-card { padding: 1.4rem; margin-bottom: 1.4rem; }
.section-card-head { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: 1.2rem; }
.section-card h2, .project-profit-card h2 { color: var(--ink); margin: .15rem 0 0; font-size: 1.25rem; }
.table-wrap { overflow-x: auto; border-radius: 12px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 760px; }
th { background: rgba(79,163,209,.12); color: var(--blue-dark); text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .055em; padding: .85rem 1rem; border-bottom: 1px solid #cfe2ec; }
td { padding: .95rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: .9rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfdfe; }
td small, th small, .block { display: block; }
th small { text-transform: none; letter-spacing: 0; font-weight: 500; margin-top: .2rem; color: #607a8a; }
.badge { display: inline-flex; padding: .35rem .62rem; border-radius: 999px; font-size: .74rem; font-weight: 800; white-space: nowrap; }
.badge-success { color: #28712e; background: var(--green-soft); }
.badge-danger { color: #a83030; background: var(--danger-soft); }
.badge-warning { color: #8a5a12; background: var(--warning-soft); }
.badge-neutral { color: #5f707a; background: #edf1f4; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 43px; gap: .4rem; padding: .72rem 1.05rem; border: 1px solid transparent; border-radius: 10px; text-decoration: none; font-weight: 800; font-size: .88rem; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: var(--blue-dark); box-shadow: 0 8px 18px rgba(31,78,121,.22); }
.button-primary:hover { background: #173f63; }
.button-secondary { color: var(--blue-dark); background: var(--blue-soft); border-color: #cce4f0; }
.button-danger { color: white; background: var(--danger); }
.button-ghost { color: #526775; background: white; border-color: var(--line); }
.button-small { min-height: 36px; padding: .48rem .78rem; }
.button-large { min-height: 52px; padding: .9rem 1.4rem; font-size: 1rem; }
.button-full { width: 100%; }
.text-link { color: var(--blue-dark); font-weight: 750; text-decoration: none; }
.text-link:hover { color: var(--blue); text-decoration: underline; }
.muted { color: var(--muted); }
.fine-print { font-size: .78rem; color: var(--muted); text-align: center; }
.alert { padding: .85rem 1rem; margin-bottom: 1rem; border-radius: 10px; border: 1px solid; line-height: 1.4; }
.alert-success { background: var(--green-soft); border-color: #bce4be; color: #2f6b33; }
.alert-warning { background: var(--warning-soft); border-color: #efd6a6; color: #805410; }
.alert-danger { background: var(--danger-soft); border-color: #efc4c4; color: #9d3030; }
.week-nav { display: flex; align-items: center; gap: .7rem; background: white; border: 1px solid var(--line); border-radius: 12px; padding: .3rem; white-space: nowrap; }
.week-nav a { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; color: var(--blue-dark); text-decoration: none; font-size: 1.4rem; }
.week-nav a:hover { background: var(--blue-soft); }
.week-nav strong { padding: 0 .35rem; font-size: .86rem; color: var(--ink); }
.form-card { padding: 1.6rem; }
.narrow-form { max-width: 760px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
label { display: grid; gap: .45rem; color: var(--ink); font-weight: 750; font-size: .88rem; }
label small { color: var(--muted); font-weight: 400; line-height: 1.35; }
input, select, textarea { width: 100%; border: 1px solid #cddbe3; background: white; color: var(--ink); border-radius: 9px; padding: .72rem .8rem; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(79,163,209,.14); }
textarea { resize: vertical; }
.form-span { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; gap: .7rem; margin-top: 1.6rem; }
.form-footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-top: 1rem; }
.check-label { display: flex; align-items: center; gap: .65rem; }
.check-label input, .check-card input { width: 18px; height: 18px; accent-color: var(--blue); }
.employee-picker { border: 0; border-top: 1px solid var(--line); margin: 1.6rem 0 0; padding: 1.4rem 0 0; }
.employee-picker legend { color: var(--ink); font-weight: 800; padding: 0 .6rem 0 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .7rem; }
.check-card { display: flex; align-items: center; gap: .7rem; border: 1px solid var(--line); padding: .8rem; border-radius: 10px; }
.check-card:has(input:checked) { background: var(--blue-soft); border-color: #b9dcea; }
.check-card span { display: grid; }
.person-cell { display: flex; align-items: center; gap: .6rem; }
.actions-cell { text-align: right; }
.inline-form { display: inline; margin-left: .55rem; }
.link-button { appearance: none; border: 0; padding: 0; background: transparent; color: var(--blue-dark); font-weight: 750; cursor: pointer; }
.link-button:hover { color: var(--blue); text-decoration: underline; }
.mail-error { margin-top: .35rem; max-width: 250px; color: var(--danger); }
.mail-error summary { cursor: pointer; font-size: .75rem; }
.mail-error small { overflow-wrap: anywhere; }
.settings-test { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1.2rem; }
.project-code { color: var(--blue-dark); background: var(--blue-soft); border-radius: 6px; padding: .22rem .42rem; font-size: .72rem; font-weight: 850; letter-spacing: .04em; display: inline-block; }
.hours-input { min-width: 68px; max-width: 82px; text-align: right; padding: .55rem; }
.schedule-table td:first-child { min-width: 210px; }
.schedule-table td:first-child small { color: var(--muted); margin-top: .2rem; }
.percent-input { display: flex; align-items: center; gap: .25rem; min-width: 88px; }
.percent-input input { width: 68px; padding: .55rem; text-align: right; }
.percent-input span { color: var(--muted); }
.allocation-table td:first-child { min-width: 100px; }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.filter-bar { background: white; border: 1px solid var(--line); padding: 1rem; border-radius: 14px; display: flex; align-items: end; gap: .8rem; margin-bottom: 1.2rem; }
.filter-bar label { min-width: 180px; }
.filter-spacer { flex: 1; }
.project-metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(315px, 1fr)); gap: 1.2rem; }
.project-profit-card { padding: 1.35rem; }
.profit-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.profit-kpi { margin: 1.3rem 0; padding: 1rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: grid; }
.profit-kpi span, .profit-kpi small { color: var(--muted); }
.profit-kpi strong { font-size: 2rem; margin: .15rem 0; }
.positive { color: var(--green-dark); }
.negative { color: var(--danger); }
.metric-list { margin: 0; }
.metric-list div { display: flex; justify-content: space-between; gap: 1rem; padding: .42rem 0; }
.metric-list dt { color: var(--muted); }
.metric-list dd { margin: 0; color: var(--ink); font-weight: 700; }
.card-link { display: block; margin-top: 1rem; padding-top: .9rem; color: var(--blue-dark); text-decoration: none; font-weight: 800; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.kpi-grid article { padding: 1.2rem; display: grid; }
.kpi-grid span { color: var(--muted); font-size: .85rem; }
.kpi-grid strong { color: var(--ink); font-size: 1.55rem; margin-top: .35rem; }
.kpi-grid .kpi-highlight { border-color: #aedeb0; background: linear-gradient(145deg, white, var(--green-soft)); }
.empty-state { background: white; border: 1px dashed #c9d8df; border-radius: var(--radius); padding: 4rem 2rem; text-align: center; }
.empty-state h1, .empty-state h2 { color: var(--ink); }
.empty-state p { color: var(--muted); }
.empty-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-size: 1.6rem; margin: 0 auto; }
.empty-cell { text-align: center; color: var(--muted); padding: 2rem; }
.audit-json { display: block; white-space: pre-wrap; max-width: 360px; margin-top: .5rem; font-size: .72rem; }
.auth-body { background: white; }
.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(400px, 1.05fr) minmax(460px, .95fr); }
.login-brand-panel { background: linear-gradient(150deg, #f1faff 0%, #eaf7f5 100%); padding: clamp(2rem, 6vw, 5.5rem); display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; position: relative; }
.login-brand-panel::before, .login-brand-panel::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(79,163,209,.28); }
.login-brand-panel::before { width: 620px; height: 220px; right: -170px; top: 20%; transform: rotate(-12deg); }
.login-brand-panel::after { width: 540px; height: 180px; left: -220px; bottom: 10%; transform: rotate(17deg); border-color: rgba(107,196,109,.3); }
.login-logo { width: 190px; height: 150px; object-fit: contain; object-position: left top; position: relative; z-index: 1; }
.login-brand-copy { position: relative; z-index: 1; max-width: 610px; }
.login-brand-copy h1 { color: var(--blue-dark); font-size: clamp(2.6rem, 5vw, 4.8rem); line-height: .98; letter-spacing: -.055em; margin: .5rem 0 1.2rem; }
.login-brand-copy > p:last-child { color: #527080; font-size: 1.15rem; line-height: 1.6; max-width: 540px; }
.login-form-panel { display: grid; place-items: center; padding: 2rem; }
.login-card { width: min(440px, 100%); display: grid; gap: 1.2rem; }
.login-card h2 { color: var(--ink); font-size: 2.2rem; margin: .2rem 0; }
.auth-error { min-height: 100vh; display: grid; place-content: center; text-align: center; gap: .8rem; padding: 2rem; }
.auth-error img { width: 170px; margin: 0 auto; }
.sidebar-backdrop { display: none; }
@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-102%); transition: transform .2s ease; box-shadow: 24px 0 70px rgba(0,0,0,.16); }
  .menu-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(15,38,52,.42); z-index: 25; }
  .menu-open .sidebar-backdrop { display: block; }
  .menu-button { display: block; }
  .topbar { padding: 0 1.2rem; }
  .main-content { padding: 1.5rem; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .topbar-actions .text-link { display: none; }
  .topbar-title { font-size: .72rem; }
  .main-content { padding: 1rem; }
  .page-heading, .heading-actions { align-items: stretch; flex-direction: column; gap: 1rem; }
  .heading-with-date { flex-direction: row; align-items: flex-end; }
  .live-time { font-size: 1.25rem; }
  .hero-grid { grid-template-columns: 1fr; }
  .metric-stack { grid-template-columns: repeat(2, 1fr); }
  .clock-card { min-height: 285px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-span { grid-column: auto; }
  .form-footer, .filter-bar { align-items: stretch; flex-direction: column; }
  .settings-test { align-items: stretch; flex-direction: column; }
  .filter-bar label { min-width: 0; }
  .filter-spacer { display: none; }
  .kpi-grid { grid-template-columns: 1fr; }
  .login-layout { grid-template-columns: 1fr; }
  .login-brand-panel { min-height: 32vh; padding: 1.5rem; justify-content: flex-end; }
  .login-logo { position: absolute; top: 1rem; left: 1.5rem; width: 118px; height: 92px; }
  .login-brand-copy h1 { font-size: 2.25rem; max-width: 420px; }
  .login-brand-copy > p:last-child { display: none; }
  .login-form-panel { padding: 2rem 1.4rem; align-items: start; }
}
@media (max-width: 500px) {
  .metric-stack { grid-template-columns: 1fr; }
  .time-pair { gap: 1.5rem; }
  .time-pair strong { font-size: 2.25rem; }
  .week-nav strong { font-size: .75rem; }
  .form-actions { align-items: stretch; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
