:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --text: #182230;
  --muted: #667085;
  --line: #e5e9f0;
  --navy: #111b2e;
  --blue: #3468f5;
  --blue-soft: #eaf0ff;
  --green: #12a36d;
  --green-soft: #e7f8f1;
  --yellow: #e49b11;
  --yellow-soft: #fff4d8;
  --red: #db4754;
  --red-soft: #ffe9ec;
  --purple: #7a5af8;
  --sidebar-width: 232px;
  --person-width: 210px;
  --day-width: 96px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) 1fr; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width);
  color: #d7deea; background: var(--navy); padding: 26px 18px;
  display: flex; flex-direction: column; z-index: 20;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 28px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  color: white; background: linear-gradient(135deg, #4778ff, #7658f7); font-weight: 800;
}
.brand strong, .brand span { display: block; }
.brand strong { color: white; font-size: 16px; }
.brand span { color: #8692a6; font-size: 11px; margin-top: 3px; letter-spacing: .04em; }
.main-nav { display: grid; gap: 7px; }
.nav-item {
  border: 0; color: #aeb8c8; background: transparent; border-radius: 10px;
  padding: 12px 13px; text-align: left; display: flex; align-items: center; gap: 11px;
}
.nav-item span { font-size: 17px; }
.nav-item b { margin-left: auto; background: #e94e5c; color: white; font-size: 10px; border-radius: 12px; padding: 2px 7px; }
.nav-item:hover, .nav-item.active { color: white; background: rgba(255,255,255,.09); }
.sidebar-section { margin-top: 30px; padding: 0 10px; display: grid; gap: 12px; }
.sidebar-title { color: #758195; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 3px; }
.filter-check { font-size: 13px; display: flex; gap: 9px; align-items: center; cursor: pointer; }
.filter-check input { accent-color: var(--blue); }
.sync-card {
  margin-top: auto; border: 1px solid rgba(255,255,255,.1); border-radius: 12px;
  padding: 13px; display: flex; gap: 10px; align-items: center; background: rgba(255,255,255,.04);
}
.sync-card strong, .sync-card small { display: block; }
.sync-card strong { color: white; font-size: 12px; }
.sync-card small { color: #7e8a9d; font-size: 10px; margin-top: 3px; }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: #2fd28f; box-shadow: 0 0 0 4px rgba(47,210,143,.12); }

.main-content { grid-column: 2; padding: 28px 32px 44px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.eyebrow { color: var(--blue); font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: 4px 0 0; font-size: 27px; letter-spacing: -.03em; }
.mobile-sync-status { display: none; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.account-button {
  height: 38px; padding: 0 13px; border: 1px solid #cfdaff; border-radius: 9px;
  display: inline-flex; align-items: center; gap: 7px; background: #eef3ff; color: #2b59d8; font-weight: 700;
}
.account-button span { font-size: 9px; }
.icon-button, .primary-button, .danger-button {
  min-height: 38px; padding: 0 15px; border-radius: 9px; border: 1px solid var(--line); background: white; color: #344054; font-weight: 650;
}
.icon-button:hover { background: #f7f8fa; }
.primary-button { border-color: var(--blue); background: var(--blue); color: white; box-shadow: 0 7px 18px rgba(52,104,245,.18); }
.primary-button:hover { background: #285bdf; }
.danger-button { color: var(--red); border-color: #ffd0d5; background: var(--red-soft); }
.square { width: 38px; padding: 0; font-size: 24px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 17px 19px; box-shadow: 0 2px 10px rgba(16,24,40,.025); }
.stat-card span, .stat-card small { display: block; color: var(--muted); }
.stat-card span { font-size: 12px; font-weight: 650; }
.stat-card strong { display: block; font-size: 27px; margin: 7px 0 3px; letter-spacing: -.04em; }
.stat-card small { font-size: 10px; }
.stat-card .positive { color: var(--green); }
.stat-card .warning { color: var(--yellow); }
.stat-card .danger { color: var(--red); }
.danger-card { border-color: #ffd9dd; }

.toolbar-panel {
  display: flex; justify-content: space-between; align-items: center; gap: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 13px 13px 0 0; padding: 13px 16px;
}
.date-controls, .toolbar-actions { display: flex; align-items: center; gap: 8px; }
.range-title { margin-left: 8px; font-size: 14px; font-weight: 750; min-width: 205px; }
.search-box {
  height: 38px; min-width: 235px; border: 1px solid var(--line); border-radius: 9px;
  display: flex; align-items: center; gap: 7px; padding: 0 11px; background: #fafbfc; color: #98a2b3;
}
.search-box input { border: 0; outline: 0; background: transparent; width: 100%; color: var(--text); font-size: 12px; }
select { height: 38px; border: 1px solid var(--line); border-radius: 9px; background: white; padding: 0 30px 0 11px; color: #344054; }
.segmented { padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #f6f8fa; display: flex; }
.segmented button { border: 0; padding: 7px 11px; border-radius: 6px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; }
.segmented button.active { color: var(--blue); background: white; box-shadow: 0 1px 4px rgba(16,24,40,.1); }

.schedule-card { background: white; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 13px 13px; overflow: hidden; }
.schedule-hint { min-height: 42px; padding: 0 17px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.schedule-expand-actions { display: none; }
.expand-schedule-button {
  border: 1px solid #cfdaff; border-radius: 8px; background: #eef3ff; color: #2b59d8;
  min-height: 34px; padding: 0 11px; font-size: 11px; font-weight: 750;
}
.close-expanded-button { display: none; }
.legend { display: flex; gap: 13px; align-items: center; }
.legend i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; margin-right: -8px; }
.legend .confirmed { background: var(--blue); }
.legend .pending { background: var(--yellow); }
.legend .progress { background: var(--green); }
.legend .conflict { background: var(--red); }
.schedule-scroll { overflow: auto; max-height: calc(100vh - 354px); min-height: 460px; }
.schedule-grid { min-width: max-content; position: relative; }
.grid-row { display: grid; grid-template-columns: var(--person-width) repeat(var(--days), var(--day-width)); position: relative; min-height: 55px; }
.grid-row.header-row { position: sticky; top: 0; z-index: 12; min-height: 54px; background: #f9fafb; }
.person-cell {
  position: sticky; left: 0; z-index: 8; background: white; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 14px; gap: 10px;
}
.header-row .person-cell { z-index: 15; background: #f9fafb; }
.person-avatar { flex: 0 0 31px; height: 31px; border-radius: 9px; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: white; }
.person-meta strong, .person-meta span { display: block; }
.person-meta strong { font-size: 12px; }
.person-meta span { color: #98a2b3; font-size: 9px; margin-top: 3px; }
.day-cell {
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: var(--day-width);
  background-image: linear-gradient(to bottom, rgba(255,255,255,0), rgba(250,251,252,.25));
}
.day-cell.weekend { background-color: #fafbfe; }
.day-cell.today { background-color: #f0f5ff; }
.day-header {
  display: grid; place-items: center; align-content: center; gap: 2px; color: var(--muted);
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 10px; font-weight: 650;
}
.day-header strong { color: #344054; font-size: 13px; }
.day-header.today strong { color: var(--blue); }
.events-layer { position: absolute; left: var(--person-width); right: 0; top: 0; bottom: 0; pointer-events: none; }
.event-block {
  position: absolute; top: 8px; height: 39px; border-radius: 7px; padding: 6px 9px; overflow: hidden;
  pointer-events: auto; cursor: grab; border: 1px solid transparent; user-select: none; box-shadow: 0 2px 5px rgba(16,24,40,.06);
}
.event-block:active { cursor: grabbing; }
.event-block strong, .event-block span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-block strong { font-size: 10px; }
.event-block span { font-size: 8px; margin-top: 3px; opacity: .75; }
.event-block.confirmed { color: #244ebe; background: var(--blue-soft); border-color: #cbd8ff; }
.event-block.pending { color: #986700; background: var(--yellow-soft); border-color: #ffe0a1; }
.event-block.progress { color: #08794f; background: var(--green-soft); border-color: #bcebd9; }
.event-block.draft { color: #5c3fd2; background: #f0edff; border-color: #d8d0ff; }
.event-block.has-conflict { color: #b42331; background: var(--red-soft); border-color: #ffbac2; }
.conflict-badge {
  position: absolute; top: -6px; right: -5px; width: 17px; height: 17px; border-radius: 50%;
  display: grid; place-items: center; background: var(--red); color: white; font-size: 9px; font-weight: 900;
}
.empty-state { padding: 60px; text-align: center; color: var(--muted); }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(10,18,32,.42); backdrop-filter: blur(3px); padding: 20px; }
.modal { width: min(640px, 100%); background: white; border-radius: 16px; box-shadow: 0 24px 70px rgba(10,18,32,.25); overflow: hidden; }
.modal-header { display: flex; justify-content: space-between; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.modal h2 { margin: 4px 0 0; font-size: 21px; }
.close-button { border: 0; background: transparent; font-size: 25px; color: #98a2b3; }
.form-grid { padding: 21px 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid label { color: #475467; font-size: 11px; font-weight: 650; display: grid; gap: 7px; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; outline: 0; color: var(--text); background: white; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { border-color: #87a5ff; box-shadow: 0 0 0 3px #edf2ff; }
.span-2 { grid-column: span 2; }
.modal-footer { padding: 14px 24px 20px; display: flex; gap: 9px; align-items: center; }
.footer-spacer { flex: 1; }
.hidden { display: none !important; }
.toast {
  position: fixed; z-index: 200; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: #182230; color: white; padding: 11px 17px; border-radius: 9px; font-size: 12px;
  opacity: 0; pointer-events: none; transition: .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.auth-screen {
  position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(circle at 20% 15%, #25365f, #111b2e 48%, #0a1120);
}
.auth-card {
  width: min(420px, 100%); background: white; border-radius: 19px; padding: 31px;
  box-shadow: 0 30px 90px rgba(0,0,0,.35); display: grid; gap: 17px;
}
.auth-mark { width: 48px; height: 48px; }
.auth-card h1 { font-size: 25px; }
.auth-card p { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.auth-card label { display: grid; gap: 7px; color: #475467; font-size: 11px; font-weight: 700; }
.auth-card input { height: 43px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; outline: 0; }
.auth-card input:focus { border-color: #87a5ff; box-shadow: 0 0 0 3px #edf2ff; }
.auth-submit { height: 43px; }
.auth-error { min-height: 16px; color: var(--red); font-size: 11px; text-align: center; }
.read-only-banner {
  position: fixed; left: 50%; bottom: 18px; z-index: 80; transform: translateX(-50%);
  background: #182230; color: white; padding: 8px 14px; border-radius: 99px; font-size: 10px;
}

.project-list-card {
  background: white; border: 1px solid var(--line); border-radius: 13px; overflow: hidden;
  box-shadow: 0 2px 10px rgba(16,24,40,.025);
}
.activity-card {
  background: white; border: 1px solid var(--line); border-radius: 13px; overflow: hidden;
  box-shadow: 0 2px 10px rgba(16,24,40,.025);
}
.activity-list { max-height: calc(100vh - 205px); overflow: auto; }
.activity-row {
  min-height: 72px; padding: 13px 18px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--line);
}
.activity-row:last-child { border-bottom: 0; }
.activity-icon {
  flex: 0 0 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  font-size: 11px; font-weight: 800;
}
.activity-icon.insert { color: #08794f; background: var(--green-soft); }
.activity-icon.update { color: #244ebe; background: var(--blue-soft); }
.activity-icon.delete { color: #b42331; background: var(--red-soft); }
.activity-main { min-width: 0; flex: 1; font-size: 12px; }
.activity-main span { display: block; color: var(--muted); font-size: 10px; margin-top: 5px; }
.activity-row time { color: #98a2b3; font-size: 10px; white-space: nowrap; }
.project-list-header {
  min-height: 76px; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.project-list-header h2 { margin: 4px 0 0; font-size: 18px; }
.project-list-header > span { color: var(--muted); font-size: 11px; }
.project-table-scroll { overflow: auto; max-height: calc(100vh - 300px); }
.project-table { width: 100%; border-collapse: collapse; min-width: 960px; }
.project-table th {
  position: sticky; top: 0; z-index: 2; background: #f8fafc; color: #667085;
  padding: 12px 16px; text-align: left; font-size: 10px; letter-spacing: .03em;
  border-bottom: 1px solid var(--line);
}
.project-table td { padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 11px; vertical-align: middle; }
.project-row { cursor: pointer; }
.project-row:hover { background: #f8faff; }
.project-name strong, .project-name span { display: block; }
.project-name strong { font-size: 12px; }
.project-name span { color: #98a2b3; font-size: 9px; margin-top: 3px; }
.status-pill, .risk-pill {
  display: inline-flex; padding: 4px 8px; border-radius: 99px; font-size: 9px; font-weight: 750;
}
.status-pill.confirmed { color: #244ebe; background: var(--blue-soft); }
.status-pill.pending { color: #986700; background: var(--yellow-soft); }
.status-pill.progress { color: #08794f; background: var(--green-soft); }
.status-pill.draft { color: #5c3fd2; background: #f0edff; }
.risk-pill.conflict { color: #b42331; background: var(--red-soft); }
.risk-pill.normal { color: #08794f; background: var(--green-soft); }

.team-modal { width: min(780px, 100%); }
.team-tabs { display: flex; gap: 4px; padding: 12px 24px 0; border-bottom: 1px solid var(--line); }
.team-tab {
  border: 0; background: transparent; color: var(--muted); padding: 10px 14px;
  border-bottom: 2px solid transparent; font-size: 12px; font-weight: 700;
}
.team-tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.team-panel { padding: 18px 24px 8px; }
.setting-toolbar {
  min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.setting-toolbar strong, .setting-toolbar span { display: block; }
.setting-toolbar strong { font-size: 13px; }
.setting-toolbar span { color: #98a2b3; font-size: 10px; margin-top: 3px; }
.inline-create-form {
  display: grid; grid-template-columns: 1fr 1.3fr 1fr auto auto; gap: 9px;
  padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #f8fafc;
}
.inline-create-form input, .inline-create-form select {
  width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: white;
}
.group-form { grid-template-columns: 1fr auto auto; }
.setting-list { margin-top: 14px; max-height: 410px; overflow: auto; border: 1px solid var(--line); border-radius: 11px; }
.setting-row {
  min-height: 58px; padding: 9px 12px; display: flex; align-items: center; gap: 11px;
  border-bottom: 1px solid var(--line);
}
.setting-row:last-child { border-bottom: 0; }
.setting-row:hover { background: #fafbff; }
.setting-main { min-width: 0; flex: 1; }
.setting-main strong, .setting-main span { display: block; }
.setting-main strong { font-size: 12px; }
.setting-main span { color: #98a2b3; font-size: 10px; margin-top: 3px; }
.setting-actions { display: flex; gap: 7px; }
.small-action {
  border: 1px solid var(--line); border-radius: 7px; background: white; padding: 6px 9px;
  color: #475467; font-size: 10px; font-weight: 700;
}
.small-action:hover { background: #f4f6f8; }
.small-action.delete { color: var(--red); border-color: #ffd4d8; }
.group-count {
  min-width: 30px; text-align: center; padding: 4px 7px; border-radius: 99px;
  background: var(--blue-soft); color: var(--blue); font-size: 10px; font-weight: 750;
}
.team-modal-note { padding: 8px 24px 20px; color: #98a2b3; font-size: 10px; }
.empty-settings { padding: 30px; text-align: center; color: #98a2b3; font-size: 11px; }
.account-help {
  margin: 4px 0 12px; padding: 10px 12px; border-radius: 9px;
  color: #475467; background: #f4f7ff; font-size: 10px; line-height: 1.5;
}
.account-setting-list { max-height: 450px; }
.account-setting-row {
  min-height: 82px; padding: 10px 12px; display: grid;
  grid-template-columns: minmax(180px, 1.3fr) minmax(150px, 1fr) minmax(135px, .8fr) auto;
  align-items: end; gap: 10px; border-bottom: 1px solid var(--line);
}
.account-setting-row:last-child { border-bottom: 0; }
.account-setting-row label { display: grid; gap: 5px; color: #667085; font-size: 9px; font-weight: 700; }
.account-setting-row select { width: 100%; min-width: 0; }
.account-setting-row .primary-button { min-height: 38px; }
.account-email { align-self: center; }
.nested-backdrop { z-index: 130; background: rgba(10,18,32,.55); }
.compact-modal { width: min(470px, 100%); }
.single-column-form { grid-template-columns: 1fr; }

@media (max-width: 1100px) {
  :root { --sidebar-width: 196px; --person-width: 180px; --day-width: 88px; }
  .main-content { padding: 22px 20px; }
  .toolbar-panel { align-items: flex-start; }
  .toolbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .search-box { min-width: 190px; }
}
@media (max-width: 760px) {
  :root { --sidebar-width: 0px; --person-width: 132px; --day-width: 72px; }
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .app-shell { display: block; min-height: 100vh; }
  .sidebar {
    inset: auto 0 0 0; width: 100%; min-height: 64px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    display: block; border-radius: 18px 18px 0 0; box-shadow: 0 -10px 30px rgba(10,18,32,.18);
  }
  .brand, .sidebar-section, .sync-card { display: none; }
  .main-nav { grid-template-columns: repeat(6, 1fr); gap: 3px; }
  .nav-item {
    position: relative; min-height: 48px; padding: 5px 2px; border-radius: 12px; justify-content: center; text-align: center;
    flex-direction: column; gap: 2px; font-size: 10px; line-height: 1.1;
  }
  .nav-item span { font-size: 16px; line-height: 1; }
  .nav-item b { position: absolute; right: 12px; top: 4px; margin-left: 0; padding: 1px 5px; font-size: 9px; }
  .main-content { grid-column: 1; padding: 14px 10px 22px; }
  .topbar { display: block; margin-bottom: 12px; }
  .top-actions { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
  #todayButton { display: none; }
  .account-button { height: 42px; padding: 0 11px; }
  .icon-button, .primary-button, .danger-button { min-height: 42px; padding: 0 12px; }
  h1 { font-size: 22px; }
  .mobile-sync-status {
    display: inline-flex; align-items: center; margin-top: 7px; padding: 4px 8px;
    border-radius: 99px; background: #eef3ff; color: #2b59d8; font-size: 9px; font-weight: 700;
  }
  .mobile-sync-status[data-state="online"] { background: var(--green-soft); color: #08794f; }
  .mobile-sync-status[data-state="warning"] { background: var(--yellow-soft); color: #986700; }
  .mobile-sync-status[data-state="error"] { background: var(--red-soft); color: #b42331; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
  .stat-card { padding: 11px 12px; border-radius: 12px; }
  .stat-card strong { font-size: 22px; margin: 4px 0 2px; }
  .stat-card small { display: none; }
  .toolbar-panel { display: block; padding: 10px; border-radius: 12px 12px 0 0; }
  .date-controls { justify-content: space-between; }
  .range-title { min-width: 0; flex: 1; margin-left: 4px; text-align: center; font-size: 12px; }
  .toolbar-actions { margin-top: 10px; display: grid; grid-template-columns: 1fr; gap: 8px; }
  .search-box { width: 100%; min-width: 0; }
  #departmentFilter { display: block; width: 100%; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; min-height: 34px; }
  .schedule-hint { display: block; padding: 10px 12px; line-height: 1.5; }
  .legend { margin-top: 6px; flex-wrap: wrap; justify-content: flex-start; gap: 8px 12px; }
  .schedule-expand-actions { display: block; margin-top: 9px; }
  .expand-schedule-button { width: 100%; }
  .schedule-scroll {
    max-height: 280px; min-height: 280px; -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  body.schedule-expanded { overflow: hidden; padding-bottom: 0; }
  body.schedule-expanded .schedule-card {
    position: fixed; inset: 0; z-index: 300; border: 0; border-radius: 0; display: flex; flex-direction: column;
    padding-top: env(safe-area-inset-top); background: white;
  }
  body.schedule-expanded .schedule-hint { flex: 0 0 auto; padding: 10px 12px; }
  body.schedule-expanded .schedule-hint > span,
  body.schedule-expanded .legend,
  body.schedule-expanded #expandSchedule { display: none; }
  body.schedule-expanded .schedule-expand-actions { margin: 0; }
  body.schedule-expanded .close-expanded-button { display: block; }
  body.schedule-expanded .schedule-scroll { flex: 1; max-height: none; min-height: 0; }
  body.schedule-expanded .grid-row { min-height: 56px; }
  body.schedule-expanded .grid-row.header-row { min-height: 50px; }
  .activity-list { max-height: calc(100vh - 225px); }
  .activity-row { align-items: flex-start; padding: 12px 13px; gap: 9px; }
  .activity-row time { font-size: 9px; }
  .grid-row { min-height: 52px; }
  .grid-row.header-row { min-height: 48px; }
  .person-cell { padding: 0 8px; gap: 7px; }
  .person-avatar { flex-basis: 28px; height: 28px; border-radius: 8px; font-size: 10px; }
  .person-meta strong { font-size: 11px; }
  .person-meta span { max-width: 84px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .event-block { top: 7px; height: 37px; padding: 6px 7px; border-radius: 8px; }
  .event-block strong { font-size: 10px; }
  .event-block span { font-size: 8px; }
  .project-list-header { min-height: 64px; padding: 13px 14px; }
  .project-table-scroll { max-height: calc(100vh - 240px); -webkit-overflow-scrolling: touch; }
  .project-table { min-width: 780px; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal {
    width: 100%; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0;
    box-shadow: 0 -18px 50px rgba(10,18,32,.22);
  }
  .modal-header { padding: 18px 18px 12px; }
  .modal h2 { font-size: 19px; }
  .form-grid { grid-template-columns: 1fr; padding: 16px 18px; gap: 12px; }
  .form-grid input, .form-grid select, .form-grid textarea { min-height: 42px; font-size: 16px; }
  .span-2 { grid-column: span 1; }
  .modal-footer {
    position: sticky; bottom: 0; background: white; padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
  }
  .team-tabs { padding: 8px 18px 0; }
  .team-panel { padding: 14px 18px 6px; }
  .setting-toolbar { align-items: flex-start; }
  .setting-toolbar .primary-button { padding: 0 10px; white-space: nowrap; }
  .setting-list { max-height: 52vh; }
  .setting-row { align-items: flex-start; }
  .setting-actions { flex-direction: column; }
  .account-setting-row { grid-template-columns: 1fr; align-items: stretch; padding: 13px; }
  .account-setting-row .primary-button { width: 100%; }
  .inline-create-form, .group-form { grid-template-columns: 1fr; }
  .auth-screen { padding: 14px; align-items: end; }
  .auth-card { padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); border-radius: 18px; }
  .read-only-banner, .toast { bottom: calc(82px + env(safe-area-inset-bottom)); width: calc(100% - 24px); text-align: center; }
}

@media (max-width: 420px) {
  :root { --person-width: 118px; --day-width: 64px; }
  .main-content { padding-left: 8px; padding-right: 8px; }
  .nav-item { font-size: 9px; }
  .top-actions { grid-template-columns: 1fr 1fr auto; }
  .stats-grid { gap: 6px; }
  .stat-card { padding: 10px; }
  .schedule-scroll { max-height: 250px; min-height: 250px; }
  .person-meta span { max-width: 72px; }
}
