:root {
  color-scheme: light;
  --bg-1: #f5f2e8;
  --bg-2: #e6f0eb;
  --ink: #152126;
  --muted: #5b6a70;
  --accent: #0c7c6c;
  --accent-2: #f0b34f;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: #ffffff;
  --grid-line: rgba(15, 33, 37, 0.1);
  --weekend: #f7e1bf;
  --night: #e6eef3;
  --selection: rgba(12, 124, 108, 0.25);
  --selection-border: rgba(12, 124, 108, 0.8);
  --now: rgba(240, 179, 79, 0.45);
  --shadow: 0 14px 34px rgba(15, 33, 37, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Avenir", "Gill Sans", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fffaf1 0%, var(--bg-1) 40%, var(--bg-2) 100%);
  min-height: 100vh;
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--grid-line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.brand-badge {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #1c9b86);
  display: grid;
  place-items: center;
  color: white;
  font-size: 16px;
  box-shadow: var(--shadow);
}

.nav {
  display: flex;
  gap: 18px;
  align-items: center;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.4px;
}

.nav a.active {
  color: var(--ink);
}

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

button,
input,
select {
  font-family: inherit;
}

.btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 9px 14px;
  border-radius: 9px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(12, 124, 108, 0.18);
}

.btn.secondary {
  background: white;
  color: var(--accent);
  border: 1px solid rgba(12, 124, 108, 0.3);
  box-shadow: none;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(90, 110, 115, 0.3);
  box-shadow: none;
}

.layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 20px;
  padding: 20px 28px 30px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--grid-line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 8px;
  font-size: 17px;
}

.panel p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.search {
  position: relative;
}

.search input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--grid-line);
  font-size: 13px;
  background: white;
}

.search-results {
  position: absolute;
  top: 44px;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--grid-line);
  border-radius: 12px;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: var(--shadow);
  display: none;
  z-index: 20;
}

.search-results.active {
  display: block;
}

.search-results button {
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 1px solid rgba(15, 33, 37, 0.08);
}

.search-results button:hover {
  background: rgba(12, 124, 108, 0.08);
}

.settings-list {
  display: grid;
  gap: 10px;
  font-size: 13px;
}

.settings-list label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
}

.settings-list input[type='checkbox'] {
  accent-color: var(--accent);
}

.select {
  width: 100%;
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px solid var(--grid-line);
  background: white;
  font-size: 13px;
}

.location-list {
  display: grid;
  gap: 10px;
}

.location-card {
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  border: 1px solid rgba(15, 33, 37, 0.1);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.location-card .title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.location-card small {
  color: var(--muted);
}

.location-card .actions {
  display: flex;
  gap: 6px;
}

.location-card button {
  border: none;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  font-size: 12px;
}

.grid-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.grid-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.grid-toolbar .date-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.date-controls input {
  padding: 7px 9px;
  border-radius: 7px;
  border: 1px solid var(--grid-line);
  font-size: 13px;
}

.hover-bar {
  background: rgba(12, 124, 108, 0.1);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.grid-wrap {
  border-radius: 14px;
  border: 1px solid var(--grid-line);
  background: #fbfaf7;
  overflow: auto;
  max-height: 560px;
  position: relative;
  box-shadow: var(--shadow);
}

.grid {
  display: grid;
  grid-template-columns: 86px repeat(var(--loc-count), minmax(130px, 1fr));
  grid-auto-rows: var(--row-height, 44px);
  min-width: 720px;
}

.cell {
  padding: 4px 6px;
  border-right: 1px solid var(--grid-line);
  border-bottom: 1px solid var(--grid-line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.cell.header {
  background: #f7f5ef;
  font-weight: 700;
  z-index: 5;
}

.cell.header.time {
  justify-content: flex-start;
  padding-left: 10px;
  left: 0;
  z-index: 6;
}

.cell.header.location {
  flex-direction: column;
  gap: 4px;
  text-align: center;
}

.cell.header.location .meta {
  font-size: 10px;
  color: var(--muted);
}

.cell.header.location .actions {
  display: flex;
  gap: 6px;
}

.cell.header.location button {
  border: none;
  background: rgba(12, 124, 108, 0.08);
  color: var(--accent);
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 6px;
  cursor: pointer;
}

.cell.time-label {
  justify-content: flex-start;
  padding-left: 10px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.8);
  position: sticky;
  left: 0;
  z-index: 4;
}

.cell.time-label.now {
  background: var(--now);
}

.cell.time-cell {
  cursor: pointer;
  transition: background 0.2s ease;
}

.cell.time-cell.is-night {
  background: var(--night);
}

.cell.time-cell.is-weekend {
  background: var(--weekend);
}

.cell.time-cell.is-now {
  background: var(--now);
}

.cell.time-cell:hover,
.cell.time-cell.hovered {
  background: rgba(12, 124, 108, 0.14);
}

.cell.selection {
  background: var(--selection);
  outline: 2px solid var(--selection-border);
  outline-offset: -2px;
}

.cell.day-row {
  grid-column: 1 / -1;
  background: rgba(12, 124, 108, 0.08);
  font-weight: 700;
  justify-content: flex-start;
  padding-left: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-size: 11px;
}

.sticky {
  position: sticky;
  top: 0;
}

.selection-panel {
  background: var(--panel);
  border: 1px solid var(--grid-line);
  border-radius: 14px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.selection-panel.hidden {
  display: none;
}

.selection-times {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  font-size: 12px;
}

.selection-editor {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.selection-editor input {
  padding: 7px 9px;
  border-radius: 7px;
  border: 1px solid var(--grid-line);
  font-size: 12px;
}

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

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

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .grid {
    min-width: 640px;
  }
}

.hours-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
}

.hour-card {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  padding: 10px;
  border: 1px solid rgba(15, 33, 37, 0.1);
  text-align: center;
  font-size: 12px;
}

.hour-card strong {
  display: block;
  font-size: 16px;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(240px, 1fr);
  gap: 20px;
}

.widget-preview {
  border-radius: 16px;
  border: 1px solid var(--grid-line);
  overflow: hidden;
  min-height: 260px;
  background: white;
}

.code-block {
  background: #1c2a30;
  color: #e0f1ed;
  padding: 12px;
  border-radius: 12px;
  font-family: \"Source Code Pro\", \"Courier New\", monospace;
  font-size: 12px;
  overflow-x: auto;
}
