:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --surface-3: #e6ebef;
  --text: #172033;
  --muted: #627084;
  --muted-2: #8792a2;
  --border: #d7dde6;
  --border-strong: #b7c1cf;
  --primary: #2563eb;
  --primary-ink: #ffffff;
  --danger: #b42318;
  --success: #0f766e;
  --warning: #b45309;
  --focus: #2563eb;
  --shadow: 0 12px 32px rgba(21, 30, 45, 0.08);
  --radius: 8px;
  --sidebar: #111827;
  --sidebar-ink: #f9fafb;
  --sidebar-muted: #a7b0bf;
  --free-bg: #fff7d6;
  --free-border: #d9a600;
  --sick-bg: #ffe5d0;
  --sick-border: #d97706;
  --vacation-bg: #ffe1e7;
  --vacation-border: #e11d48;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f141b;
  --surface: #171d26;
  --surface-2: #202836;
  --surface-3: #2a3444;
  --text: #e8edf5;
  --muted: #a8b2c1;
  --muted-2: #7e8999;
  --border: #303b4c;
  --border-strong: #4b5870;
  --primary: #60a5fa;
  --primary-ink: #0b1220;
  --danger: #f87171;
  --success: #5eead4;
  --warning: #fbbf24;
  --focus: #93c5fd;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  --sidebar: #0b1119;
  --sidebar-ink: #f8fafc;
  --sidebar-muted: #91a0b5;
  --free-bg: #3a3318;
  --free-border: #facc15;
  --sick-bg: #3b2417;
  --sick-border: #fb923c;
  --vacation-bg: #3b1822;
  --vacation-border: #fb7185;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 430px) 1fr;
  background: var(--surface);
}

.auth-panel {
  padding: 40px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

.auth-preview {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 44px;
}

.preview-window {
  width: min(880px, 100%);
  min-height: 560px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  overflow: hidden;
}

.preview-top {
  height: 48px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
}

.preview-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-strong);
}

.preview-grid {
  display: grid;
  grid-template-columns: 90px repeat(5, 1fr);
  height: 512px;
}

.preview-hour {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  padding: 8px;
  font-size: 12px;
}

.preview-day {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 10px;
  position: relative;
}

.preview-pill {
  position: absolute;
  left: 10px;
  right: 10px;
  min-height: 42px;
  border-radius: 6px;
  padding: 7px 8px;
  color: #ffffff;
  overflow: hidden;
  font-size: 12px;
}

.auth-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

.auth-copy {
  margin: 0;
  color: var(--muted);
}

.demo-box {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--muted);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
}

.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-ink);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 244px;
  height: 100vh;
  overflow-y: auto;
  z-index: 25;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 7px;
  background: #ffffff;
  padding: 3px;
}

.brand-text {
  min-width: 0;
}

.brand-name {
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-subtitle {
  color: var(--sidebar-muted);
  font-size: 12px;
}

.nav-group {
  display: grid;
  gap: 6px;
}

.nav-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--sidebar-muted);
  text-align: left;
  border-radius: 7px;
  padding: 10px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-button:hover,
.nav-button.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--sidebar-ink);
  text-decoration: none;
}

.nav-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: currentColor;
}

.icon,
.nav-icon svg,
.btn svg,
.status-symbol svg,
.search-mark svg {
  width: 17px;
  height: 17px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-footer {
  margin-top: auto;
  color: var(--sidebar-muted);
  font-size: 12px;
  display: grid;
  gap: 8px;
  padding: 0 6px;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  grid-column: 2;
}

.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left,
.topbar-right,
.view-switch,
.button-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.topbar-title {
  font-weight: 750;
  font-size: 18px;
  white-space: nowrap;
}

.search-wrap {
  position: relative;
  min-width: 220px;
}

.search-wrap input {
  padding-left: 34px;
}

.search-mark {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.content {
  padding: 18px 20px 28px;
  min-width: 0;
}

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

.page-header h1 {
  margin: 0 0 4px;
  font-size: 22px;
  line-height: 1.2;
}

.page-header p {
  margin: 0;
  color: var(--muted);
}

.btn {
  min-height: 36px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 7px;
  padding: 7px 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  text-decoration: none;
}

.btn.primary {
  background: var(--primary);
  color: var(--primary-ink);
  border-color: var(--primary);
}

.btn.danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
}

.btn.ghost {
  background: transparent;
}

.btn.small {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.icon-btn {
  width: 36px;
  min-width: 36px;
  padding: 0;
}

.btn.small.icon-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  background: var(--surface);
}

.segmented .btn {
  border: 0;
  border-radius: 0;
  min-height: 34px;
}

.segmented .btn.active {
  background: var(--text);
  color: var(--surface);
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  padding: 7px 10px;
  outline: none;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

label span {
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}

.form-grid > * {
  grid-column: span 4;
}

.form-grid .wide {
  grid-column: span 8;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.panel,
.table-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.panel {
  padding: 14px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-title h2,
.panel-title h3 {
  margin: 0;
  font-size: 16px;
}

.muted {
  color: var(--muted);
}

.text-small {
  font-size: 12px;
}

.stack {
  display: grid;
  gap: 12px;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 14px;
  align-items: start;
}

.calendar-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  align-items: start;
}

.calendar-main {
  min-width: 0;
  display: grid;
  gap: 0;
}

.calendar-tabs-bar {
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-bottom: 0;
  background: var(--surface-2);
  border-radius: var(--radius) var(--radius) 0 0;
}

.calendar-tab {
  min-width: 148px;
  min-height: 44px;
  border: 0;
  border-right: 1px solid var(--border);
  border-bottom: 3px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  font-weight: 750;
  white-space: nowrap;
}

.calendar-tab:not(.universal) {
  border-left: 4px solid var(--tab-color, var(--primary));
}

.calendar-tab.universal {
  min-width: 132px;
}

.calendar-tab:hover,
.calendar-tab.active {
  background: var(--surface);
  border-bottom-color: var(--tab-color, var(--primary));
}

.swatch,
.avatar-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  flex: 0 0 auto;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.filter-panel {
  display: grid;
  gap: 12px;
}

.filter-panel.compact {
  padding: 12px;
  margin: 10px 0;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.check-list {
  max-height: 132px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px;
  background: var(--surface);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  padding: 5px;
  border-radius: 6px;
  font-size: 13px;
}

.check-row:hover {
  background: var(--surface-2);
}

.check-row input {
  width: 15px;
  height: 15px;
  min-height: 0;
  padding: 0;
}

.chips {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 4px 9px;
  color: var(--text);
  font-size: 12px;
}

.chip button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
}

.calendar-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.calendar-tabs-bar + .calendar-shell {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.calendar-toolbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.calendar-toolbar-title {
  flex: 0 0 auto;
  min-width: 190px;
}

.calendar-toolbar.view-day .calendar-toolbar-title {
  min-width: 180px;
}

.calendar-toolbar.view-day .calendar-toolbar-center {
  justify-content: flex-start;
  min-width: 0;
}

.calendar-toolbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.view-switch {
  flex: 0 0 auto;
}

.toolbar-icons {
  flex: 0 0 auto;
}

.sync-inline-loading {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.icon-btn.loading svg {
  animation: spin 0.9s linear infinite;
}

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

.compact-search {
  min-width: 136px;
  max-width: 220px;
  flex: 1 1 170px;
}

.day-group-toggle {
  min-width: 82px;
  flex: 0 0 auto;
}

.calendar-title {
  font-weight: 750;
}

.calendar-meta {
  color: var(--muted);
  font-size: 12px;
}

.week-grid {
  display: grid;
  grid-template-columns: 72px repeat(var(--days), minmax(116px, 1fr));
  overflow-x: auto;
}

.week-head {
  min-height: 56px;
  padding: 9px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.week-head-button {
  appearance: none;
  width: 100%;
  border-top: 0;
  border-left: 0;
  color: var(--text);
  text-align: left;
}

.week-head-button:hover {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface-2));
}

.week-head.today {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface-2));
}

.week-head-name {
  font-weight: 700;
}

.week-head-date {
  color: var(--muted);
  font-size: 12px;
}

.time-label-head {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.all-day-label {
  min-height: 88px;
  padding: 8px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.all-day-cell {
  min-height: 88px;
  padding: 6px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: grid;
  align-content: start;
  gap: 5px;
}

.time-labels {
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.hour-label {
  height: var(--hour-height, 64px);
  padding: 3px 8px 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.day-lane {
  position: relative;
  min-height: calc(var(--hours, 13) * var(--hour-height, 64px));
  border-right: 1px solid var(--border);
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(var(--hour-height, 64px) - 1px),
    var(--border) var(--hour-height, 64px)
  );
}

.day-lane.today {
  background:
    linear-gradient(color-mix(in srgb, var(--primary) 5%, transparent), color-mix(in srgb, var(--primary) 5%, transparent)),
    repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour-height, 64px) - 1px), var(--border) var(--hour-height, 64px));
}

.now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #ef4444;
  z-index: 6;
}

.now-line::before {
  content: "";
  position: absolute;
  left: -5px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
}

.event-card {
  position: relative;
  border: 1px solid var(--entry-border, color-mix(in srgb, var(--entry-color, var(--primary)) 65%, var(--border)));
  border-left: 4px solid var(--entry-color, var(--primary));
  background: var(--entry-bg, color-mix(in srgb, var(--entry-color, var(--primary)) 13%, var(--surface)));
  color: var(--text);
  border-radius: 6px;
  padding: 5px 6px;
  min-height: 30px;
  overflow: hidden;
  text-align: left;
  width: 100%;
}

.event-card.shared-event::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: var(--entry-stripe, var(--entry-color, var(--primary)));
}

.event-card:hover {
  border-color: var(--entry-color, var(--primary));
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.12);
}

.event-card.absence-free {
  background: var(--free-bg);
  border-style: dashed;
  border-left-color: var(--free-border);
}

.event-card.absence-sick {
  background: var(--sick-bg);
  border-style: dashed;
  border-left-color: var(--sick-border);
}

.event-card.absence-vacation {
  background: var(--vacation-bg);
  border-style: dashed;
  border-left-color: var(--vacation-border);
}

.day-lane,
.month-cell,
.all-day-cell {
  cursor: crosshair;
}

.event-card,
.more-button,
.conflict-mini-event {
  cursor: pointer;
}

.event-time {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.event-title {
  font-weight: 700;
  font-size: 12px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}

.event-kind {
  flex: 0 0 auto;
  border-radius: 4px;
  padding: 1px 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 10px;
}

.time-event {
  position: absolute;
  z-index: 4;
  min-height: 28px;
}

.time-event .event-card {
  height: 100%;
}

.time-event .event-time {
  display: none;
}

.time-event .event-title {
  white-space: nowrap;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  border-top: 1px solid var(--border);
}

.month-head {
  min-height: 34px;
  padding: 8px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.month-cell {
  min-height: 132px;
  padding: 7px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: grid;
  align-content: start;
  gap: 5px;
  background: var(--surface);
}

.month-cell.other-month {
  background: var(--surface-2);
  color: var(--muted);
}

.month-cell.today {
  outline: 2px solid color-mix(in srgb, var(--primary) 65%, transparent);
  outline-offset: -2px;
}

.month-date {
  width: max-content;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0 4px 2px 0;
  font-size: 12px;
  font-weight: 750;
  text-align: left;
}

.month-date:hover {
  color: var(--primary);
  text-decoration: underline;
}

.more-button {
  border: 0;
  background: transparent;
  color: var(--primary);
  text-align: left;
  padding: 2px;
  font-size: 12px;
}

.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
}

.detail-drawer {
  position: absolute;
  top: 86px;
  right: 18px;
  width: min(560px, calc(100vw - 36px));
  max-height: calc(100vh - 104px);
  overflow: auto;
  box-shadow: var(--shadow);
  pointer-events: auto;
  animation: drawer-in 150ms ease-out;
}

@keyframes drawer-in {
  from {
    transform: translateX(18px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.detail-head {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.detail-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 12, 20, 0.58);
}

.event-modal {
  width: min(760px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  box-shadow: var(--shadow);
}

.day-list-modal {
  width: min(560px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  box-shadow: var(--shadow);
}

.day-list-items {
  display: grid;
  gap: 8px;
}

.day-list-item {
  width: 100%;
  min-height: 58px;
  border: 1px solid var(--entry-border, var(--border));
  border-left: 4px solid var(--entry-color, var(--primary));
  border-radius: 7px;
  background: var(--entry-bg, var(--surface));
  color: var(--text);
  padding: 8px 10px;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  text-align: left;
}

.day-list-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-list-time {
  color: var(--muted);
  white-space: nowrap;
}

.attendees-list {
  max-height: 156px;
}

.conflict-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--surface-2);
}

.conflict-box.warning {
  border-color: color-mix(in srgb, var(--warning) 45%, var(--border));
}

.conflict-box.ok {
  border-color: color-mix(in srgb, var(--success) 45%, var(--border));
}

.conflict-list {
  display: grid;
  gap: 10px;
  margin: 10px 0;
}

.conflict-item {
  display: grid;
  gap: 7px;
}

.conflict-user {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 750;
}

.conflict-mini-calendar {
  display: grid;
  gap: 6px;
}

.conflict-mini-event {
  border: 1px solid color-mix(in srgb, var(--entry-color, var(--primary)) 55%, var(--border));
  border-left: 4px solid var(--entry-color, var(--primary));
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  padding: 7px 8px;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.conflict-mini-event span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.detail-row {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

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

.detail-row dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.json-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px;
  overflow: auto;
  max-height: 240px;
  font-size: 12px;
  line-height: 1.45;
}

.user-status-panel {
  position: static;
}

.status-list {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.status-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 54px;
  padding: 8px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--user-color, var(--primary));
  border-radius: 7px;
  background: var(--surface);
}

.status-symbol {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--status-color, var(--primary));
  background: color-mix(in srgb, var(--status-color, var(--primary)) 13%, var(--surface-2));
}

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

.status-name {
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-reason {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-label {
  color: var(--status-color, var(--primary));
  border: 1px solid color-mix(in srgb, var(--status-color, var(--primary)) 45%, var(--border));
  border-radius: 999px;
  padding: 3px 8px;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
}

.legend-list {
  display: grid;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.legend-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

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

.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-weight: 700;
  background: var(--surface-2);
  font-size: 12px;
}

.table td {
  background: var(--surface);
}

.role-badge,
.status-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 2px 8px;
  font-size: 12px;
  background: var(--surface-2);
}

.status-badge.ok {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 45%, var(--border));
}

.status-badge.warn {
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 45%, var(--border));
}

.status-badge.error {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
}

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

.stat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px;
  background: var(--surface);
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
}

.toast-wrap {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 36px));
}

.toast {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  padding: 11px 12px;
  box-shadow: var(--shadow);
}

.toast.error {
  border-color: color-mix(in srgb, var(--danger) 50%, var(--border));
}

.hidden {
  display: none !important;
}

@media (max-width: 1180px) {
  .calendar-page,
  .two-col {
    grid-template-columns: 1fr;
  }

  .user-status-panel {
    position: static;
  }

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

  .calendar-toolbar {
    flex-wrap: wrap;
  }

  .calendar-toolbar-center {
    order: 3;
    width: 100%;
  }
}

@media (max-width: 860px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-preview {
    display: none;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    left: auto;
    bottom: auto;
    width: auto;
    height: auto;
    z-index: 30;
    padding: 10px;
  }

  .main {
    grid-column: auto;
  }

  .brand {
    border-bottom: 0;
    padding-bottom: 4px;
  }

  .nav-group {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
  }

  .nav-button {
    width: auto;
  }

  .sidebar-footer {
    display: none;
  }

  .topbar {
    flex-wrap: wrap;
    align-items: stretch;
  }

  .topbar-left,
  .topbar-right {
    width: 100%;
    flex-wrap: wrap;
  }

  .search-wrap {
    flex: 1 1 220px;
  }

  .calendar-tabs-bar {
    border-radius: var(--radius);
  }

  .calendar-tab {
    min-width: 132px;
  }

  .detail-drawer {
    top: 12px;
    right: 12px;
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }

  .content {
    padding: 14px;
  }

  .filter-grid,
  .form-grid,
  .source-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .form-grid > *,
  .form-grid .wide,
  .form-grid .full {
    grid-column: 1;
  }

  .week-grid {
    grid-template-columns: 58px repeat(var(--days), minmax(132px, 1fr));
  }

  .month-grid {
    grid-template-columns: repeat(7, minmax(108px, 1fr));
    overflow-x: auto;
  }
}
