:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --ink: #18212f;
  --muted: #697586;
  --subtle: #94a0af;
  --line: #dfe5eb;
  --line-strong: #cfd7e0;
  --primary: #285d72;
  --primary-strong: #1f4a5c;
  --primary-soft: #e9f2f5;
  --danger: #b44646;
  --danger-soft: #fbeeee;
  --success: #277a63;
  --warning: #a56a18;
  --counseling: #7857b5;
  --counseling-soft: #f0ebf9;
  --coaching: #0d8e83;
  --coaching-soft: #e4f5f2;
  --lecture: #d86724;
  --lecture-soft: #fff0e6;
  --work: #2674b9;
  --work-soft: #e7f1fa;
  --contact: #536176;
  --task: #8d992f;
  --shadow-sm: 0 1px 2px rgba(23, 33, 47, 0.05);
  --shadow-md: 0 14px 38px rgba(23, 33, 47, 0.12);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --sidebar-width: 258px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Pretendard, "Pretendard Variable", "Noto Sans KR", "Apple SD Gothic Neo",
    "Malgun Gothic", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.noscript {
  margin: 16px;
  padding: 14px 18px;
  border: 1px solid #e8c06d;
  border-radius: var(--radius-sm);
  background: #fff7df;
  color: #70490c;
}

.fatal-error {
  margin: 24px;
  padding: 16px 18px;
  border: 1px solid #e2b8b8;
  border-radius: 10px;
  background: var(--danger-soft);
  color: #713939;
  font-weight: 700;
}

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.button:hover {
  border-color: #aeb9c5;
  background: var(--surface-soft);
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.button-primary:hover {
  border-color: var(--primary-strong);
  background: var(--primary-strong);
}

.button-ghost {
  background: transparent;
}

.button-danger-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--danger);
}

.button-danger-ghost:hover {
  border-color: #ecc4c4;
  background: var(--danger-soft);
}

.button-large {
  min-height: 50px;
  padding: 13px 20px;
  border-radius: 12px;
}

.icon-button {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
}

.icon-button:hover {
  background: rgba(29, 45, 60, 0.08);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(37, 111, 145, 0.23);
  outline-offset: 2px;
}

/* Login */
.login-view {
  min-height: 100vh;
  padding: 30px clamp(18px, 4vw, 58px);
  background:
    radial-gradient(circle at 12% 5%, rgba(56, 121, 145, 0.14), transparent 32%),
    radial-gradient(circle at 94% 90%, rgba(216, 103, 36, 0.1), transparent 29%),
    #eff3f4;
}

.login-brand {
  max-width: 1240px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 auto 26px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 11px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.03em;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.1);
}

.brand-mark.small {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 10px;
  background: #f2f7f8;
  color: var(--primary);
  box-shadow: none;
}

.brand-name {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.login-card {
  width: min(1240px, 100%);
  min-height: min(720px, calc(100vh - 130px));
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(420px, 1.08fr);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(186, 198, 205, 0.8);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 30px 80px rgba(44, 63, 74, 0.13);
}

.login-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(38px, 6vw, 82px);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-copy h1 {
  margin: 0;
  font-size: clamp(32px, 4.1vw, 54px);
  font-weight: 850;
  line-height: 1.22;
  letter-spacing: -0.055em;
}

.login-description {
  max-width: 600px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.login-features {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 30px 0 0;
  color: #475464;
  font-size: 14px;
  font-weight: 700;
}

.login-features span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.feature-dot,
.quick-grid i,
.quick-menu i {
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 50%;
  background: currentColor;
}

.dot-counseling {
  color: var(--counseling);
  background: var(--counseling) !important;
}

.dot-coaching {
  color: var(--coaching);
  background: var(--coaching) !important;
}

.dot-lecture {
  color: var(--lecture);
  background: var(--lecture) !important;
}

.dot-work {
  color: var(--work);
  background: var(--work) !important;
}

.setup-alert {
  margin-top: 26px;
  padding: 14px 16px;
  border: 1px solid #e6c27d;
  border-radius: 11px;
  background: #fff8e8;
  color: #674512;
}

.setup-alert strong {
  display: block;
  margin-bottom: 5px;
}

.setup-alert p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}

.setup-alert code {
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(112, 73, 12, 0.08);
}

.login-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.google-g {
  width: 23px;
  height: 23px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: #4285f4;
  font-size: 13px;
  font-weight: 900;
}

.login-status,
.security-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.security-note {
  max-width: 580px;
  margin-top: 9px;
  color: var(--subtle);
}

.login-preview {
  display: grid;
  place-items: center;
  padding: 44px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(33, 83, 101, 0.96), rgba(44, 74, 86, 0.94)),
    var(--primary);
}

.preview-window {
  width: min(650px, 100%);
  aspect-ratio: 1.1;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  background: #f4f6f8;
  box-shadow: 0 32px 70px rgba(0, 0, 0, 0.25);
  transform: rotate(-1.5deg);
}

.preview-top {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  background: #fff;
}

.preview-top span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d3d9df;
}

.preview-body {
  height: calc(100% - 38px);
  display: grid;
  grid-template-columns: 20% 1fr;
}

.preview-sidebar {
  padding: 24px 14px;
  background: #233544;
}

.preview-logo {
  width: 30px;
  height: 30px;
  margin-bottom: 30px;
  border-radius: 8px;
  background: #e8f3f5;
}

.preview-sidebar i {
  width: 72%;
  height: 7px;
  display: block;
  margin: 18px 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.19);
}

.preview-main {
  padding: 9% 7%;
}

.preview-heading {
  width: 43%;
  height: 18px;
  margin-bottom: 8%;
  border-radius: 7px;
  background: #33424f;
}

.preview-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3%;
}

.preview-cards i {
  height: 72px;
  border: 1px solid #e0e5e9;
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.preview-cards i:nth-child(1) {
  border-top: 4px solid var(--counseling);
}

.preview-cards i:nth-child(2) {
  border-top: 4px solid var(--coaching);
}

.preview-cards i:nth-child(3) {
  border-top: 4px solid var(--lecture);
}

.preview-cards i:nth-child(4) {
  border-top: 4px solid var(--work);
}

.preview-columns {
  display: grid;
  grid-template-columns: 1.35fr 0.8fr;
  gap: 4%;
  margin-top: 7%;
}

.preview-list {
  min-height: 160px;
  padding: 16px;
  border: 1px solid #e0e5e9;
  border-radius: 11px;
  background: #fff;
}

.preview-list b,
.preview-list i {
  display: block;
  border-radius: 7px;
  background: #e9edf0;
}

.preview-list b {
  width: 34%;
  height: 10px;
  margin-bottom: 20px;
  background: #7c8993;
}

.preview-list i {
  width: 100%;
  height: 23px;
  margin: 10px 0;
}

.preview-list.compact i {
  height: 46px;
}

/* App shell */
.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 20px 15px;
  overflow-y: auto;
  background: #253642;
  color: #eaf0f3;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 5px 7px 23px;
}

.sidebar-brand strong {
  display: block;
  font-size: 15px;
}

.sidebar-brand span:not(.brand-mark) {
  display: block;
  margin-top: 4px;
  color: #94a7b4;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.main-nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #bdc9d0;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.active {
  background: #eef5f6;
  color: #244c5b;
}

.nav-icon {
  width: 22px;
  display: inline-grid;
  place-items: center;
  font-size: 18px;
  font-weight: 400;
}

.sidebar-quick {
  margin-top: 34px;
  padding: 0 7px;
}

.sidebar-quick > p {
  margin: 0 0 11px;
  color: #91a4b0;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}

.quick-grid button {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 9px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  color: #c8d3d9;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.quick-grid button:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.sidebar-account {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding: 17px 7px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.account-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e5eff1;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.account-copy {
  min-width: 0;
}

.account-copy strong,
.account-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy strong {
  font-size: 12px;
}

.account-copy span {
  margin-top: 3px;
  color: #93a6b2;
  font-size: 10px;
}

.sidebar-account .icon-button {
  width: 34px;
  height: 34px;
  color: #9fb0ba;
  font-size: 17px;
}

.workspace {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 clamp(20px, 3.5vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.global-search {
  width: min(520px, 54vw);
  height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--bg);
  color: var(--subtle);
}

.global-search:focus-within {
  border-color: #a8c0ca;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(40, 93, 114, 0.08);
}

.global-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}

.global-search input::placeholder {
  color: #939faa;
}

.global-search kbd {
  padding: 3px 6px;
  border: 1px solid #d5dce2;
  border-radius: 5px;
  background: #fff;
  color: #89949f;
  font-size: 9px;
  font-family: inherit;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 13px;
}

.sync-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.sync-indicator i,
.autosave-status i {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--success);
}

.sync-indicator.saving i,
.autosave-status.saving i {
  background: var(--warning);
  animation: pulse 1.1s infinite;
}

.sync-indicator.error i,
.autosave-status.error i {
  background: var(--danger);
}

.sync-indicator.demo i {
  background: var(--lecture);
}

.mobile-menu {
  display: none;
}

.main-content {
  width: min(1520px, 100%);
  margin: 0 auto;
  padding: 36px clamp(20px, 3.5vw, 48px) 60px;
  outline: none;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.page-title-group h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.25;
  letter-spacing: -0.04em;
}

.page-title-group p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.demo-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  padding: 12px 15px;
  border: 1px solid #ecd2a4;
  border-radius: 11px;
  background: #fff7e8;
  color: #704c17;
  font-size: 12px;
  line-height: 1.6;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  position: relative;
  min-height: 132px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--primary);
}

.stat-card.counseling::before {
  background: var(--counseling);
}

.stat-card.coaching::before {
  background: var(--coaching);
}

.stat-card.lecture::before {
  background: var(--lecture);
}

.stat-card.work::before {
  background: var(--work);
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stat-value {
  display: block;
  margin-top: 17px;
  font-size: 30px;
  font-weight: 850;
  letter-spacing: -0.04em;
}

.stat-caption {
  display: block;
  margin-top: 5px;
  color: var(--subtle);
  font-size: 10px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(290px, 0.75fr);
  gap: 18px;
}

.panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel-header {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 {
  margin: 0;
  font-size: 15px;
}

.panel-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.text-button {
  padding: 5px;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.timeline-list {
  padding: 6px 18px;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 78px 12px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  min-height: 82px;
  padding: 16px 0;
  border-bottom: 1px solid #edf0f3;
}

.timeline-item:last-child {
  border-bottom: 0;
}

.timeline-date {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  text-align: right;
}

.timeline-date strong {
  display: block;
  color: var(--ink);
  font-size: 12px;
}

.timeline-dot {
  position: relative;
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--work);
  box-shadow: 0 0 0 1px var(--work);
}

.timeline-dot.counseling {
  background: var(--counseling);
  box-shadow: 0 0 0 1px var(--counseling);
}

.timeline-dot.coaching {
  background: var(--coaching);
  box-shadow: 0 0 0 1px var(--coaching);
}

.timeline-dot.lecture {
  background: var(--lecture);
  box-shadow: 0 0 0 1px var(--lecture);
}

.timeline-copy {
  min-width: 0;
}

.timeline-copy button {
  max-width: 100%;
  display: block;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.timeline-copy p {
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type-badge,
.status-badge,
.priority-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 23px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 850;
  white-space: nowrap;
}

.type-badge.counseling {
  background: var(--counseling-soft);
  color: #64439c;
}

.type-badge.coaching {
  background: var(--coaching-soft);
  color: #08796f;
}

.type-badge.lecture {
  background: var(--lecture-soft);
  color: #b65018;
}

.type-badge.work {
  background: var(--work-soft);
  color: #185f9c;
}

.status-badge {
  background: #eef2f4;
  color: #5f6d78;
}

.status-badge.done {
  background: #e6f4ef;
  color: #27725f;
}

.priority-badge.high {
  background: var(--danger-soft);
  color: var(--danger);
}

.task-list {
  padding: 7px 18px;
}

.task-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 14px 0;
  border-bottom: 1px solid #edf0f3;
}

.task-item:last-child {
  border-bottom: 0;
}

.task-check {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #bdc7cf;
  border-radius: 5px;
  background: #fff;
  color: #fff;
  font-size: 10px;
  cursor: pointer;
}

.task-check.checked {
  border-color: var(--success);
  background: var(--success);
}

.task-copy {
  min-width: 0;
}

.task-copy button {
  width: 100%;
  display: block;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 750;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.task-copy span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.task-item.completed .task-copy button {
  color: var(--subtle);
  text-decoration: line-through;
}

.loading-state,
.empty-state {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 42px 20px;
  color: var(--muted);
  text-align: center;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #d8e0e4;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.empty-symbol {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 22px;
}

.empty-state h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.empty-state p {
  max-width: 390px;
  margin: 0;
  font-size: 11px;
  line-height: 1.7;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-bottom: 16px;
}

.filter-chip {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.filter-chip:hover {
  border-color: #aab7c1;
}

.filter-chip.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.table-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 13px 15px;
  border-bottom: 1px solid #edf0f3;
  font-size: 11px;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.02em;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr {
  cursor: pointer;
}

.data-table tbody tr:hover {
  background: #fafcfd;
}

.table-title {
  display: block;
  max-width: 430px;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-subtitle {
  display: block;
  max-width: 430px;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}

.record-card {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.record-card:hover {
  border-color: #bdc8d0;
  box-shadow: 0 8px 22px rgba(23, 33, 47, 0.07);
}

.record-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.record-card h3 {
  margin: 14px 0 0;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-card p {
  min-height: 34px;
  margin: 8px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.record-card-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #edf0f3;
  color: var(--subtle);
  font-size: 9px;
}

.search-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.search-grid .panel:last-child {
  grid-column: 2;
}

.search-result-list {
  padding: 6px 16px;
}

.search-result-item {
  width: 100%;
  min-height: 62px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 10px 2px;
  border: 0;
  border-bottom: 1px solid #edf0f3;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.search-result-item:last-child {
  border-bottom: 0;
}

.search-result-item:hover {
  background: #fafcfd;
}

.search-result-item > span:nth-child(2) {
  min-width: 0;
}

.search-result-item strong,
.search-result-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-item strong {
  font-size: 11px;
}

.search-result-item small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
}

.search-result-item > i {
  color: var(--subtle);
  font-size: 20px;
  font-style: normal;
}

.search-empty {
  padding: 26px 18px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.setting-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.setting-card.wide {
  grid-column: 1 / -1;
}

.setting-card h2 {
  margin: 0;
  font-size: 15px;
}

.setting-card p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.75;
}

.setting-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.info-list {
  display: grid;
  gap: 0;
  margin: 18px 0 0;
}

.info-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid #edf0f3;
  font-size: 11px;
}

.info-row:last-child {
  border-bottom: 0;
}

.info-row dt {
  color: var(--muted);
}

.info-row dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.privacy-list {
  margin: 14px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
}

.archive-list {
  display: grid;
  gap: 0;
  margin-top: 16px;
  border-top: 1px solid var(--line);
}

.archive-item {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.archive-item > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.archive-item strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-item small {
  color: var(--subtle);
  white-space: nowrap;
}

.archive-item .button {
  min-height: 34px;
  flex: 0 0 auto;
  padding: 6px 11px;
  font-size: 10px;
}

.archive-empty {
  margin-top: 14px;
  padding: 16px;
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.mobile-nav,
.quick-menu {
  display: none;
}

/* Modal and forms */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(14, 25, 34, 0.58);
  backdrop-filter: blur(4px);
}

.modal {
  width: min(920px, 100%);
  max-height: min(900px, calc(100vh - 44px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border-radius: 19px;
  background: #fff;
  box-shadow: var(--shadow-md);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px 17px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.modal-header .eyebrow {
  margin-bottom: 6px;
}

.modal-close {
  font-size: 27px;
  font-weight: 300;
}

.record-form {
  padding: 22px 24px 34px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.form-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  padding: 6px 0 24px;
  border-bottom: 1px solid var(--line);
}

.form-section + .form-section {
  padding-top: 24px;
}

.form-section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.form-section-title {
  grid-column: 1 / -1;
  margin: 0 0 1px;
  color: #4d5b68;
  font-size: 12px;
  font-weight: 850;
}

.form-field {
  min-width: 0;
}

.form-field.wide {
  grid-column: 1 / -1;
}

.form-field label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 7px;
  color: #465462;
  font-size: 11px;
  font-weight: 800;
}

.form-field label .required {
  color: var(--danger);
}

.form-field label .sensitive-label {
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 8px;
}

.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: 0;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.55;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.form-field textarea {
  min-height: 82px;
  resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  border-color: #779aa9;
  box-shadow: 0 0 0 3px rgba(40, 93, 114, 0.09);
}

.form-field input[aria-invalid="true"],
.form-field textarea[aria-invalid="true"],
.form-field select[aria-invalid="true"] {
  border-color: var(--danger);
}

.field-hint {
  display: block;
  margin-top: 6px;
  color: var(--subtle);
  font-size: 9px;
  line-height: 1.55;
}

.modal-footer {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  border-top: 1px solid var(--line);
  background: #fbfcfd;
}

.autosave-status {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.modal-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-region {
  position: fixed;
  z-index: 200;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  width: min(360px, calc(100vw - 36px));
  padding: 13px 15px;
  border: 1px solid #ccd5dc;
  border-radius: 10px;
  background: #24323d;
  color: #fff;
  box-shadow: var(--shadow-md);
  font-size: 11px;
  line-height: 1.6;
  animation: toast-in 0.2s ease-out;
}

.toast.error {
  background: #713939;
}

.toast.success {
  background: #23624f;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  50% { opacity: 0.35; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

@media (max-width: 1120px) {
  .login-card {
    grid-template-columns: 1fr;
  }

  .login-preview {
    display: none;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .record-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  :root {
    --sidebar-width: 244px;
  }

  body.menu-open {
    overflow: hidden;
  }

  .sidebar {
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-md);
  }

  body.menu-open .sidebar {
    transform: translateX(0);
  }

  body.menu-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(12, 23, 31, 0.42);
  }

  .workspace {
    margin-left: 0;
  }

  .mobile-menu {
    display: inline-grid;
  }

  .topbar {
    height: 64px;
    padding: 0 16px;
  }

  .global-search {
    width: min(440px, 62vw);
  }

  .global-search kbd,
  .sync-indicator span {
    display: none;
  }

  .main-content {
    padding: 26px 18px 92px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .search-grid {
    grid-template-columns: 1fr;
  }

  .search-grid .panel:last-child {
    grid-column: auto;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .setting-card.wide {
    grid-column: auto;
  }

  .mobile-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 35;
    height: 68px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 -8px 24px rgba(23, 33, 47, 0.06);
    backdrop-filter: blur(14px);
  }

  .mobile-nav button {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 3px;
    padding: 4px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 9px;
    font-weight: 750;
  }

  .mobile-nav button span {
    font-size: 17px;
  }

  .mobile-nav button.active {
    color: var(--primary);
  }

  .mobile-nav .mobile-new span {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    margin-top: -20px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 24px;
    box-shadow: 0 7px 17px rgba(40, 93, 114, 0.28);
  }

  .quick-menu {
    position: fixed;
    z-index: 90;
    left: 50%;
    bottom: 76px;
    width: min(310px, calc(100vw - 30px));
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 7px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow-md);
    transform: translateX(-50%);
  }

  .quick-menu button {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-soft);
    font-size: 11px;
    font-weight: 800;
  }
}

@media (max-width: 620px) {
  .login-view {
    padding: 18px 14px;
  }

  .login-brand {
    margin-bottom: 14px;
  }

  .login-card {
    min-height: calc(100vh - 84px);
    border-radius: 20px;
  }

  .login-copy {
    justify-content: flex-start;
    padding: 38px 24px;
  }

  .login-copy h1 br {
    display: none;
  }

  .login-description {
    margin-top: 17px;
  }

  .login-actions {
    display: grid;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }

  .stat-card {
    min-height: 116px;
    padding: 16px;
  }

  .stat-value {
    margin-top: 12px;
    font-size: 25px;
  }

  .page-header {
    display: grid;
    gap: 14px;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .button {
    flex: 1;
  }

  .global-search {
    width: auto;
    flex: 1;
  }

  #top-new-button {
    width: 42px;
    overflow: hidden;
    padding: 9px;
    font-size: 0;
  }

  #top-new-button::before {
    content: "＋";
    color: #fff;
    font-size: 20px;
  }

  .record-card-grid {
    grid-template-columns: 1fr;
  }

  .table-card {
    overflow-x: auto;
  }

  .data-table {
    min-width: 650px;
  }

  .timeline-item {
    grid-template-columns: 60px 10px minmax(0, 1fr);
    gap: 9px;
  }

  .timeline-item > .type-badge {
    grid-column: 3;
    justify-self: start;
  }

  .demo-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal {
    max-height: calc(100vh - 12px);
    border-radius: 18px 18px 0 0;
  }

  .modal-header {
    padding: 17px 18px 14px;
  }

  .record-form {
    padding: 18px 18px 30px;
  }

  .form-section {
    grid-template-columns: 1fr;
  }

  .form-field.wide,
  .form-section-title {
    grid-column: auto;
  }

  .modal-footer {
    align-items: stretch;
    flex-direction: column;
    padding: 11px 15px calc(11px + env(safe-area-inset-bottom));
  }

  .modal-footer-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .modal-footer-actions .button:only-child {
    grid-column: 1 / -1;
  }

  #save-close-button {
    grid-column: 1 / -1;
  }

  .info-row {
    grid-template-columns: 90px minmax(0, 1fr);
  }

  .archive-item > div {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
