:root {
  color-scheme: light;
  --bg: #f6f5f2;
  --panel: #ffffff;
  --ink: #151515;
  --muted: #5a5a5a;
  --line: #d9d6cf;
  --accent: #1f5f6f;
  --accent-soft: #e2f0f4;
  --danger: #b23b3b;
  --shadow: 0 12px 30px rgba(17, 28, 31, 0.08);
  --radius: 14px;
  --font: "Avenir Next", "IBM Plex Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(circle at top, #ffffff 0%, #f4f2ed 50%, #efece6 100%);
  color: var(--ink);
  min-height: 100vh;
  padding: 28px clamp(16px, 4vw, 40px) 48px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 28px;
}

.app-kicker {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 6px;
}

.app-title {
  margin: 0;
  font-size: clamp(1.4rem, 2.2vw, 2.1rem);
  font-weight: 700;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.ghost-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.ghost-button:hover,
.ghost-button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 95, 111, 0.12);
  outline: none;
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.slot {
  min-height: 320px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(255, 255, 255, 0.6);
}

.slot-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-radius: calc(var(--radius) - 4px);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.slot-empty h3 {
  margin: 0;
  font-size: 1rem;
}

.slot-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.slot-empty button {
  align-self: flex-start;
}

.widget-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 300px;
}

.widget-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.widget-card-icon {
  font-size: 1.2rem;
}

.widget-card-title {
  margin: 0;
  font-size: 1.1rem;
}

.card-toolbar {
  display: flex;
  gap: 8px;
}

.card-toolbar button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.widget-inputs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.input-control {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-family: var(--font);
  font-size: 0.95rem;
}

.input-control:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 95, 111, 0.15);
}

.input-error {
  min-height: 1.2em;
  color: var(--danger);
  font-size: 0.8rem;
}

.widget-result {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.widget-result-summary {
  font-size: 1.6rem;
  font-weight: 700;
}

.widget-result-detail {
  color: var(--muted);
  font-size: 0.9rem;
}

.help-toggle {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.help-toggle-button {
  align-self: flex-start;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
}

.help-toggle-panel {
  color: var(--muted);
  font-size: 0.9rem;
}

.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 19, 20, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.98);
  width: min(520px, 92vw);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

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

.panel-search {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.panel-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}

.panel-item strong {
  font-size: 0.95rem;
}

.panel-item span {
  color: var(--muted);
  font-size: 0.85rem;
}

.panel-item:focus-visible,
.panel-item:hover {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 95, 111, 0.12);
}

body.panel-open .panel-overlay {
  opacity: 1;
  pointer-events: auto;
}

body.panel-open .panel {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

@media (max-width: 720px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }
}
