:root {
  color-scheme: light;
  --paper: #f6f7fb;
  --surface: #fff;
  --ink: #17233c;
  --muted: #64728a;
  --accent: #6152e5;
  --accent-strong: #4b3bcb;
  --accent-wash: #efedff;
  --line: #e4e6f3;
  --positive: #13765b;
  --danger: #a52e43;
  --radius: 18px;
  font: 400 15px/1.5 "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); }
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.15; }
:focus-visible { outline: 3px solid #8277f3; outline-offset: 3px; }
.muted, .hint { color: var(--muted); }
.hint { font-size: .86rem; }
.skip { position: fixed; z-index: 20; top: .7rem; left: .7rem; padding: .6rem 1rem; transform: translateY(-160%); background: white; border-radius: .5rem; }
.skip:focus { transform: none; }

.brand { display: inline-flex; gap: .75rem; align-items: center; font-size: 1.27rem; font-weight: 750; line-height: 1.15; text-decoration: none; width: fit-content; }
.brand-mark { display: grid; width: 40px; height: 40px; place-items: center; flex: none; border-radius: 12px 12px 12px 4px; background: var(--accent); color: #fff; font-size: 1.48rem; font-weight: 760; }
.brand-word small { display: block; margin-top: .2rem; color: var(--muted); font-size: .72rem; font-weight: 600; white-space: nowrap; }
.button, .icon-button { min-height: 40px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); font-weight: 650; text-decoration: none; transition: background .16s ease, color .16s ease; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem .85rem; }
.button:hover, .icon-button:hover { background: var(--accent-wash); border-color: #d7d2fa; }
.button.primary { background: var(--accent); border-color: transparent; color: #fff; padding-inline: 1.05rem; }
.button.primary:hover { background: var(--accent-strong); }
.button.danger { background: #fff3f5; color: var(--danger); border-color: #f4dce4; }
.button.danger:hover { background: #fbe1e6; }
.button.wide { width: 100%; }
.button.small { min-height: 34px; padding: .35rem .65rem; font-size: .87rem; }
.icon-button { display: inline-grid; min-width: 40px; padding: 0 .45rem; place-items: center; font-size: 1.13rem; }
.text-link { color: var(--accent-strong); font-weight: 650; text-underline-offset: .2em; }

.startup { min-height: 100dvh; display: grid; align-content: center; justify-items: center; gap: 1rem; padding: 1rem; text-align: center; }
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(365px, .75fr); }
.auth-aside { display: grid; grid-template-rows: auto 1fr; position: relative; overflow: hidden; min-height: 640px; padding: clamp(2rem, 5vw, 5rem); background: linear-gradient(152deg, #282377, #5244d0 75%, #6555ea); color: #fff; }
.brand-light .brand-mark { background: #fff; color: #4135ab; }
.auth-intro { display: grid; align-content: center; justify-items: start; width: fit-content; max-width: 100%; padding-block: 4rem 6rem; }
.auth-intro h1 { font-size: clamp(2.7rem, 5.7vw, 6.2rem); letter-spacing: -.069em; line-height: .96; }
.auth-intro p { margin-top: 1.5rem; color: #e5e2ff; font-size: 1.08rem; }
.auth-illustration { position: relative; width: 235px; height: 152px; margin: 2rem 0 0 1.5rem; }
.illustration-sheet { position: absolute; inset: .6rem 2rem 0 0; padding: 1.35rem; transform: rotate(-9deg); border: 1px solid #b7adff; border-radius: 17px; background: #8d7df64d; box-shadow: .9rem .9rem #2d24776b; }
.illustration-sheet i { display: block; width: 7rem; height: 3px; margin-bottom: .6rem; border-radius: 2px; background: #d6ceff; }
.illustration-sheet i:nth-child(2) { width: 4.8rem; }
.illustration-sheet i:nth-child(3) { width: 6rem; }
.illustration-sheet span { color: #f4e7a9; letter-spacing: .24em; font-weight: 800; font-size: 1.6rem; }
.illustration-tile { position: absolute; display: grid; width: 70px; height: 70px; right: 0; bottom: -.4rem; place-items: center; border-radius: 16px; background: #f4e7a9; color: #382f9a; font-size: 2.4rem; transform: rotate(12deg); }
.auth-main { display: grid; place-items: center; padding: clamp(1.5rem, 5vw, 5rem); background: #fff; }
.auth-form { display: grid; width: min(100%, 375px); gap: 1.12rem; }
.auth-form h2 { font-size: 2.15rem; letter-spacing: -.04em; }
.auth-form .hint { margin-top: -.8rem; }

.shell { display: grid; grid-template-columns: 242px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; align-self: start; display: flex; flex-direction: column; min-height: 100dvh; padding: 1.7rem 1.1rem 1.15rem; border-right: 1px solid var(--line); background: var(--surface); }
.sidebar > .brand { margin: 0 0 2.5rem .3rem; }
.navigation { display: grid; gap: .36rem; }
.navigation a { display: flex; align-items: center; gap: .8rem; min-height: 45px; padding: .45rem .8rem; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 650; white-space: nowrap; }
.navigation a:hover { background: #f6f5ff; color: var(--ink); }
.navigation a[aria-current="page"] { color: var(--accent-strong); background: var(--accent-wash); }
.nav-icon { display: grid; width: 22px; height: 22px; place-items: center; color: var(--accent); font-size: 1.25rem; line-height: 1; }
.sidebar-bottom { margin-top: auto; padding-top: 1.4rem; }
.invite-button { width: 100%; color: var(--accent-strong); border: 1px dashed #c5bef4; margin-bottom: .9rem; font-size: .82rem; }
.account { display: flex; gap: .6rem; align-items: center; border-top: 1px solid var(--line); padding-top: .9rem; }
.account-info { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.account-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-info small { color: var(--muted); margin-top: .18rem; }
.account .icon-button { border-color: transparent; color: var(--muted); }

.content { width: 100%; min-width: 0; max-width: 1470px; margin-inline: auto; padding: clamp(1.35rem, 4vw, 3.75rem); }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem 1.8rem; margin-bottom: 1.8rem; }
.page-header h1 { font-size: clamp(2.15rem, 4vw, 3.35rem); letter-spacing: -.065em; overflow-wrap: anywhere; }
.kicker { margin-bottom: .45rem; color: var(--accent-strong); font-size: .86rem; font-weight: 700; }
.subtitle { margin-top: .55rem; color: var(--muted); }
.page-actions, .row-actions, .toolbar, .dialog-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.page-actions { justify-content: flex-end; }
.page-body, .stack { display: grid; gap: 1.15rem; min-width: 0; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 1.2rem; }
.panel-header { display: flex; gap: .6rem 1rem; align-items: baseline; justify-content: space-between; flex-wrap: wrap; margin-bottom: 1rem; }
.panel-header h2 { font-size: 1.17rem; letter-spacing: -.027em; }
.overview-grid { display: grid; gap: 1.15rem; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; }
.summary { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric { display: grid; gap: .25rem; border: 1px solid var(--line); border-radius: 15px; background: #fff; padding: 1rem; min-width: 0; }
.metric:first-child { border-color: #ded8fd; background: linear-gradient(120deg, #ede9ff, #f8f6ff); }
.metric span { color: var(--muted); font-size: .81rem; font-weight: 650; }
.metric strong { font-size: 1.55rem; font-weight: 770; letter-spacing: -.045em; overflow-wrap: anywhere; }
.metric small { color: var(--muted); min-height: 1.2em; overflow-wrap: anywhere; }
.rows { display: grid; list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: .7rem; justify-content: space-between; padding: .7rem 0; min-width: 0; }
.row + .row { border-top: 1px solid var(--line); }
.row-main { display: flex; align-items: center; gap: .7rem; min-width: 0; flex: 1; }
.row-text { display: grid; gap: .14rem; min-width: 0; }
.row-text strong, .row-text a, .row-text small { overflow-wrap: anywhere; }
.row-text small { color: var(--muted); }
.row-label { font-weight: 700; }
.avatar, .time-box, .file-box { display: inline-grid; place-items: center; flex: none; width: 40px; min-height: 40px; border-radius: 12px; background: var(--accent-wash); color: var(--accent-strong); font-weight: 750; }
.time-box { width: 54px; min-height: 46px; font-size: .89rem; }
.file-box { font-size: .67rem; text-transform: uppercase; }
.avatar:nth-child(3n), .row:nth-child(3n) .avatar { background: #eaf5ee; color: #286c51; }
.row:nth-child(3n - 1) .avatar { background: #fff2db; color: #7e5421; }
.empty { display: grid; justify-items: start; gap: .55rem; border: 1px dashed #dddff1; border-radius: 14px; padding: 1.2rem; background: #fafaff; }
.empty h3 { font-size: 1rem; }
.empty p { color: var(--muted); }
.notes { white-space: pre-wrap; overflow-wrap: anywhere; }
.badge { display: inline-flex; width: fit-content; border-radius: 999px; padding: .17rem .48rem; background: #eff0f6; color: #505d73; font-size: .72rem; font-weight: 700; }
.badge.shared { background: #e8f5ed; color: var(--positive); }
.badge.submission { background: var(--accent-wash); color: var(--accent-strong); }

.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .45rem; }
.day { display: grid; gap: .3rem; align-content: start; min-width: 0; min-height: 106px; border: 1px solid var(--line); border-radius: 12px; padding: .55rem; overflow: hidden; }
.day[aria-pressed="true"] { border-color: #8e81f1; box-shadow: inset 0 0 0 1px #8e81f1; background: #f9f8ff; }
.day:not([aria-pressed="true"]):hover { background: #f8f7fe; }
.day span, .day small { min-width: 0; overflow-wrap: anywhere; }
.day span { color: var(--muted); font-weight: 650; font-size: .78rem; }
.day strong { font-size: 1.4rem; line-height: 1; }
.day small { color: var(--accent-strong); font-size: .72rem; }
.calendar-toolbar { justify-content: space-between; margin-bottom: 1rem; }
.calendar-toolbar strong { font-size: .96rem; }

label { display: grid; gap: .32rem; font-weight: 650; }
input:not([type="checkbox"]), select, textarea { width: 100%; min-width: 0; min-height: 43px; padding: .55rem .65rem; border: 1px solid #d6dbea; border-radius: 9px; background: #fff; color: var(--ink); }
input[readonly] { background: var(--paper); }
textarea { min-height: 100px; resize: vertical; }
.checkbox-label { display: flex; align-items: center; gap: .55rem; }
.checkbox-label input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }
.form-error { color: var(--danger); background: #fff1f4; border-radius: 8px; padding: .55rem .7rem; }
dialog { width: min(94vw, 490px); max-height: 90dvh; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; color: var(--ink); background: #fff; box-shadow: 0 18px 65px #11173438; }
dialog:modal { overscroll-behavior: contain; }
dialog::backdrop { background: #18203d60; overscroll-behavior: contain; overflow: hidden; }
.dialog-header { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: 1.2rem; }
.dialog-header h2 { font-size: 1.34rem; letter-spacing: -.035em; }
.dialog-form { display: grid; gap: .85rem; }
.dialog-actions { justify-content: flex-end; margin-top: .35rem; }
.field-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(6.7rem, 1fr); gap: .65rem; }
.toast { position: fixed; inset: auto 1.15rem 1.15rem auto; z-index: 4; width: max-content; max-width: min(440px, calc(100vw - 2.3rem)); border-radius: 13px; padding: .8rem 1.05rem; background: #20294b; color: #fff; box-shadow: 0 7px 30px #18203d38; }
.toast.error { background: #8e283b; }

@media (max-width: 1060px) {
  .overview-grid { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 205px minmax(0, 1fr); }
  .sidebar { padding-inline: .75rem; }
}
@media (max-width: 760px) {
  .shell, .auth { display: block; }
  .sidebar { position: static; min-height: auto; display: grid; grid-template-columns: 1fr auto; gap: .8rem; padding: .8rem; border: 0; border-bottom: 1px solid var(--line); }
  .sidebar > .brand { margin: 0; }
  .navigation { grid-column: 1/-1; grid-row: 2; display: flex; overflow: auto; }
  .navigation a { padding-inline: .55rem; gap: .35rem; }
  .sidebar-bottom { padding: 0; display: flex; align-items: center; gap: .35rem; }
  .invite-button { width: auto; margin: 0; font-size: .76rem; }
  .account { padding: 0; border: 0; }
  .account-info, .account .avatar { display: none; }
  .auth-aside { min-height: 0; padding: 1.5rem; }
  .auth-intro { padding: 2rem 0 .5rem; }
  .auth-illustration { display: none; }
  .auth-main { padding: 2rem 1.5rem; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .page-actions { justify-content: flex-start; }
}
@media (max-width: 510px) {
  .content { padding: 1rem; }
  .panel { padding: .85rem; }
  .row { align-items: flex-start; flex-direction: column; }
  .row-actions { padding-left: 0; }
  .summary { gap: .4rem; }
  .metric { padding: .65rem; }
  .metric strong { font-size: 1.15rem; }
  .calendar { gap: .2rem; }
  .day { min-height: 75px; padding: .25rem; border-radius: 7px; }
  .day strong { font-size: 1.05rem; }
  .day small { font-size: .67rem; }
  .navigation a { font-size: .83rem; }
  .invite-button { max-width: 105px; line-height: 1.15; padding: .32rem .45rem; }
}
@media (max-width: 360px) {
  .sidebar > .brand { gap: .45rem; }
  .sidebar .brand-mark { width: 35px; height: 35px; }
  .sidebar .brand-word small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}
