
:root {
  --bg: #f3f3f2;
  --panel: rgba(255,255,255,0.74);
  --text: #232323;
  --muted: #8e8e8e;
  --line: rgba(0,0,0,0.08);
  --shadow: 0 12px 36px rgba(0,0,0,0.08);
  --radius: 24px;
  --holiday: #ef8d8d;
  --dot-size: 7px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: linear-gradient(180deg, #f6f6f5, #f0f0ef);
  color: var(--text);
  font-family: 'Archivo', system-ui, sans-serif;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.eyebrow { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.material-symbols-outlined { font-size: 20px; line-height: 1; }
.with-icon { display:inline-flex; align-items:center; gap:8px; }
.wrap-actions { flex-wrap:wrap; }
.compact-actions .button { white-space:nowrap; }
.card-like, .auth-card, .sidebar, .main-panel, .settings-card, .settings-header {
  background: rgba(255,255,255,0.72); backdrop-filter: blur(18px); border: 1px solid rgba(255,255,255,0.58); box-shadow: var(--shadow); border-radius: 28px;
}
.auth-body { display:flex; align-items:center; justify-content:center; padding:24px; }
.auth-shell { width:100%; max-width:460px; }
.auth-card { padding: 28px; }
.auth-head h1 { margin: 8px 0; font-size: 30px; }
.auth-head p { margin: 0 0 20px; color: var(--muted); }
.tabs { display:flex; gap:8px; margin-bottom:16px; }
.tab, .button, .icon-button {
  border: 1px solid var(--line); background: rgba(255,255,255,0.7); border-radius: 14px; transition: .2s ease;
}
.tab { padding: 10px 14px; }
.tab.is-active, .button.primary { background:#1f1f1f; color:#fff; border-color:#1f1f1f; }
.auth-form, .settings-form { display:grid; gap:14px; }
.auth-form label, .panel-block label, .settings-form label { display:grid; gap:8px; color:#4a4a4a; font-size:13px; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], textarea {
  width:100%; border:1px solid var(--line); background: rgba(255,255,255,0.85); border-radius: 14px; padding: 12px 14px; outline:none;
}
textarea { resize: vertical; min-height: 90px; }
.button { padding: 11px 14px; }
.button.subtle { background: rgba(255,255,255,0.7); }
.button.full { width:100%; }
.alert { padding:12px 14px; border-radius:14px; margin-bottom:16px; }
.alert.error { background:#fff0f0; color:#8b3131; border:1px solid #f2c0c0; }
.alert.success { background:#eef9f1; color:#255f3e; border:1px solid #cbe7d2; }
.form-note { color: var(--muted); font-size: 12px; margin: 0; }


.app-shell {
  display:grid;
  grid-template-columns: 360px minmax(0,1fr);
  height:100dvh;
  min-height:100dvh;
  gap: 16px;
  padding: 16px;
  align-items:stretch;
  overflow:hidden;
}
.sidebar {
  padding: 18px;
  position: sticky;
  top: 16px;
  height: calc(100dvh - 32px);
  overflow:auto;
  min-width: 0;
  width: 100%;
  transform: translateX(0);
  opacity: 1;
  transition:
    transform .28s cubic-bezier(.22,1,.36,1),
    opacity .2s ease,
    width .28s ease,
    padding .28s ease,
    margin .28s ease,
    border-color .2s ease,
    box-shadow .2s ease;
}
.sidebar-header, .panel-head, .user-row, .topbar, .topbar-left, .year-controls, .inline-actions, .switch-row { display:flex; align-items:center; }
.sidebar-header, .panel-head, .user-row, .topbar { justify-content:space-between; }
.sidebar-header h1 { margin: 4px 0 0; font-size: 24px; }
.icon-button { width: 40px; height: 40px; display:grid; place-items:center; }
.icon-button:hover, .button:hover, .tab:hover { transform: translateY(-1px); }
.panel-block { padding: 16px 0; border-top:1px solid var(--line); }
.panel-block.compact { padding-top: 12px; }
.user-row p { color:var(--muted); margin:4px 0 0; font-size:12px; }
.selected-date { font-size: 18px; margin-bottom: 14px; }
.pill { padding: 6px 10px; border-radius: 999px; background:#efefef; font-size:12px; color:#555; }
.switch-row { justify-content:space-between; padding: 4px 0 12px; gap:12px; }
.field-grid.two { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.inline-actions { gap: 10px; }
.label-list { display:grid; gap:10px; }
.label-option { display:flex; align-items:center; gap:10px; padding:10px 12px; border:1px solid var(--line); border-radius:14px; background:rgba(255,255,255,0.6); }
.label-option input { width:auto; }
.swatch { width:12px; height:12px; border-radius:999px; display:inline-block; }
.new-label-form { display:grid; grid-template-columns: 1fr 54px auto; gap:8px; margin-top:12px; }
input[type="color"], input[type="file"] { width:100%; min-height:44px; border:1px solid var(--line); background:#fff; border-radius:14px; padding:4px; }

.main-panel {
  min-width:0;
  width: 100%;
  max-width: 100%;
  height: calc(100dvh - 32px);
  padding: 22px;
  overflow:hidden;
  position:relative;
  display:flex;
  flex-direction:column;
}
.topbar { gap:16px; margin-bottom: 12px; }
.topbar-left { gap:12px; }
.topbar h2 { margin: 4px 0 0; font-size: 28px; font-weight: 600; }
.calendar-wrap {
  overflow:hidden;
  width:100%;
  flex:1;
  min-height:0;
}
.calendar-grid {
  display:grid;
  grid-template-columns: repeat(4, minmax(220px,1fr));
  grid-template-rows: repeat(3, minmax(0,1fr));
  gap: clamp(16px, 2vh, 28px) clamp(16px, 1.7vw, 28px);
  padding: 4px;
  width:100%;
  height:100%;
  min-height:0;
  align-content:stretch;
}
.month-card { min-width:0; display:grid; grid-template-rows:auto auto 1fr; min-height:0; }
.month-name { color:#9b9b9b; margin-bottom: 10px; font-size: 20px; }
.weekdays, .days-grid { display:grid; grid-template-columns: repeat(7, minmax(0,1fr)); }
.weekdays { color:#a6a6a6; font-size:13px; margin-bottom: 6px; }
.days-grid { grid-auto-rows: minmax(0, 1fr); min-height: 0; }
.weekdays div, .day-cell {
  position:relative;
  min-height:48px;
  padding: 1px 0;
  border:none;
  background:transparent;
  border-radius: 0;
  color:#2f2f2f;
  user-select:none;
  touch-action:none;
  transition: transform .14s ease, background .16s ease, color .16s ease, box-shadow .16s ease;
}
.day-cell:hover { background: transparent; transform: translateY(-1px); }
.calendar-grid.is-dragging .day-cell { cursor: grabbing; }
.day-cell.is-outside { color:#d7d7d7; }
.day-cell.is-selected::after { content:none; }
.day-cell.is-active-range::before,
.day-cell.is-preview-range::before {
  content:'';
  position:absolute;
  top:1px;
  bottom:1px;
  left:-1px;
  right:-1px;
  border-radius:0;
  z-index:0;
}
.day-cell.is-active-range::before { background: rgba(76,95,211,0.12); }
.day-cell.is-preview-range::before { background: rgba(76,95,211,0.18); }
.day-cell.range-start::before,
.day-cell.preview-start::before {
  left:50%;
  right:-1px;
  border-top-right-radius:999px;
  border-bottom-right-radius:999px;
}
.day-cell.range-end::before,
.day-cell.preview-end::before {
  left:-1px;
  right:50%;
  border-top-left-radius:999px;
  border-bottom-left-radius:999px;
}
.day-cell.range-single::before,
.day-cell.preview-single::before {
  left:8px;
  right:8px;
  border-radius:999px;
}
.day-cell.is-today { font-weight: 700; }
.day-cell.has-holiday { color: var(--holiday); font-weight: 600; }
.day-inner {
  position:relative;
  z-index:2;
  width:46px;
  height:46px;
  aspect-ratio:1 / 1;
  margin:0 auto;
  border-radius:50%;
  display:grid;
  place-items:center;
  line-height:1;
}
.day-cell.is-selected .day-inner {
  box-shadow: inset 0 0 0 2px #4c5fd3;
}
.day-cell.is-preview-range .day-inner { font-weight: 600; }
.range-stack {
  position:absolute;
  inset: 1px -1px;
  border-radius:0;
  overflow:hidden;
  z-index:1;
  display:flex;
  flex-direction:column;
  gap:0;
  padding:0;
}
.range-bar { flex:1; opacity:1; border-radius:0; }
.range-bar.edge-start { border-top-left-radius:999px; border-bottom-left-radius:999px; margin-left: 50%; }
.range-bar.edge-end { border-top-right-radius:999px; border-bottom-right-radius:999px; margin-right: 50%; }
.range-bar.edge-single { margin:0 1px; border-radius:999px; }
.day-cell .marker-dot {
  position:absolute;
  top:6px;
  left:50%;
  transform: translateX(-50%);
  width:var(--dot-size);
  height:var(--dot-size);
  border-radius:999px;
  z-index:3;
}
.tooltip {
  position: fixed; pointer-events:none; background: rgba(24,24,24,0.92); color:#fff; padding:10px 12px; border-radius:12px; font-size:12px; max-width:220px; z-index:999;
  opacity:0; transform: translateY(6px); transition: .14s ease; white-space:pre-line;
}
.tooltip.is-visible { opacity:1; transform: translateY(0); }
.toast {
  position: fixed; right: 18px; bottom: 18px; padding: 12px 14px; background: rgba(23,23,23,0.92); color:#fff; border-radius:14px;
  box-shadow: var(--shadow); opacity:0; transform: translateY(10px); transition:.2s ease; pointer-events:none;
}
.toast.is-visible { opacity:1; transform: translateY(0); }
.hidden-desktop { display:none; }
.floating-sidebar-toggle {
  position:absolute;
  top:18px;
  right:18px;
  width:42px;
  height:42px;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(255,255,255,0.8);
  display:none;
  place-items:center;
  box-shadow: var(--shadow);
  z-index:8;
}

@media (min-width: 1181px) {
  .app-shell.inspector-collapsed {
    grid-template-columns: 0 minmax(0, 1fr);
    gap: 0;
  }

  .app-shell.inspector-collapsed .sidebar {
    width: 0;
    padding-left: 0;
    padding-right: 0;
    border-width: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transform: translateX(-20px);
    box-shadow: none;
  }

  .app-shell.inspector-collapsed .main-panel,
  .app-shell.inspector-collapsed .calendar-wrap,
  .app-shell.inspector-collapsed .calendar-grid {
    width: 100%;
    max-width: 100%;
  }

  .app-shell.inspector-collapsed .floating-sidebar-toggle {
    display:grid;
  }
}
.settings-body { padding: 18px; }
.settings-shell { max-width: 1400px; margin: 0 auto; }
.settings-header { padding: 22px; display:flex; justify-content:space-between; gap:16px; align-items:flex-start; margin-bottom:16px; }
.settings-header h1 { margin: 6px 0 8px; font-size: 32px; }
.settings-header p { margin: 0; color: var(--muted); }
.header-actions { display:flex; gap:10px; flex-wrap:wrap; }
.settings-grid { display:grid; grid-template-columns: 1.1fr 1.3fr; gap:16px; }
.settings-card { padding:20px; }
.settings-card.wide, .settings-card.full { grid-column: span 2; }
.settings-list, .settings-users-grid, .settings-actions-stack { display:grid; gap:12px; }
.label-editor-row { display:grid; grid-template-columns: minmax(0,1fr) 72px auto auto; gap:10px; align-items:center; }
.settings-new-label { margin-top:16px; }
.settings-users-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.user-settings-card { border:1px solid var(--line); border-radius:20px; padding:16px; background:rgba(255,255,255,0.45); }
.user-settings-head { display:flex; justify-content:space-between; gap:14px; align-items:flex-start; margin-bottom:12px; }
.user-settings-head h3 { margin:0 0 4px; font-size:20px; }
.user-settings-head p { margin:0; color:var(--muted); }
.danger-text { color:#9f3b32; }


@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 1fr; }
  body { overflow: auto; }
  .main-panel { height: auto; min-height: calc(100vh - 32px); }
  .sidebar {
    position: fixed;
    inset: 16px auto 16px 16px;
    width: min(360px, calc(100vw - 32px));
    min-width: min(360px, calc(100vw - 32px));
    z-index:50;
  }
  .app-shell.inspector-collapsed {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .app-shell.inspector-collapsed .sidebar {
    width: min(360px, calc(100vw - 32px));
    min-width: min(360px, calc(100vw - 32px));
    padding: 18px;
    border-width: 1px;
    opacity: 1;
    pointer-events: none;
    transform: translateX(calc(-100% - 20px));
  }
  .hidden-desktop { display:grid; }
  .floating-sidebar-toggle { display:none !important; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-card.wide, .settings-card.full { grid-column: auto; }
}
@media (max-width: 900px) {
  .settings-users-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .main-panel, .sidebar, .auth-card, .settings-card, .settings-header { border-radius: 22px; }
  .calendar-grid { gap: 20px 16px; grid-template-columns: repeat(2, minmax(220px,1fr)); grid-template-rows:none; height:auto; }
  .month-name { font-size:18px; }
  .topbar { align-items:flex-start; flex-direction:column; }
  .field-grid.two, .label-editor-row, .new-label-form { grid-template-columns: 1fr; }
  .stack-mobile { flex-direction:column; align-items:flex-start; }
}
