:root {
  --accent: #2f6b75;
  --bg: #faf8f2;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --text: #12303b;
  --muted: #5f7175;
  --line: #ded8ca;
  --shadow: 0 14px 38px rgba(18, 48, 59, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 8%, rgba(169, 128, 62, 0.12), transparent 30%),
    linear-gradient(135deg, #faf8f2 0%, #edece1 48%, #e6eeec 100%);
  background-attachment: fixed;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

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

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 12px clamp(16px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
  background: rgba(250, 248, 242, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--accent);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.28);
}

.global-search,
.inner-search {
  display: grid;
  grid-template-columns: minmax(112px, 150px) 1fr auto;
  gap: 8px;
}

.global-search {
  max-width: 820px;
  width: 100%;
}

input,
select,
textarea {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 72%, white);
  outline-offset: 2px;
}

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

.button,
.icon-button,
.avatar-button,
.widget-actions button,
.widget-footer button,
.todo-form button,
.rss-meta button,
.inner-search button {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.88);
}

.button {
  min-height: 40px;
  padding: 0 14px;
  font-weight: 700;
}

.button.primary,
.inner-search button,
.todo-form button {
  color: white;
  border-color: transparent;
  background: var(--accent);
}

.button.danger {
  color: #b91c1c;
}

.icon-button,
.avatar-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
}

.avatar-button {
  color: white;
  border-color: transparent;
  background: #111827;
  font-weight: 800;
}

.sync-status {
  min-width: 52px;
  color: var(--muted);
  font-size: 0.86rem;
}

.dashboard-page {
  width: min(1560px, 100%);
  margin: 0 auto;
  padding: 22px clamp(14px, 3vw, 34px) 40px;
}

.dashboard-hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.9rem, 3vw, 3.1rem);
}

h2 {
  font-size: 1.08rem;
}

.privacy-toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-weight: 700;
}

.switch input {
  display: none;
}

.switch span {
  position: relative;
  display: block;
  width: 48px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #cbd5e1;
}

.switch span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  content: "";
  border-radius: 50%;
  background: white;
  transition: transform 0.2s ease;
}

.switch input:checked + span {
  background: var(--accent);
}

.switch input:checked + span::after {
  transform: translateX(20px);
}

.tabbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px;
  margin-bottom: 14px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
}

.tabs {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.tab,
.tab-add {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 8px 0 14px;
  white-space: nowrap;
  font-weight: 800;
}

.tab.active {
  color: white;
  border-color: transparent;
  background: #111827;
}

.tab small {
  display: grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(148, 163, 184, 0.18);
}

.tab.active small {
  color: white;
  background: rgba(255, 255, 255, 0.16);
}

.tab-controls {
  display: inline-flex;
  gap: 2px;
  opacity: 0.7;
}

.tab-controls span {
  display: grid;
  width: 22px;
  height: 24px;
  place-items: center;
  border-radius: 6px;
}

.tab-controls span:hover {
  background: rgba(148, 163, 184, 0.22);
}

.tab-add {
  width: 40px;
  flex: 0 0 auto;
  font-size: 1.2rem;
  font-weight: 800;
}

.dashboard-canvas {
  display: grid;
  grid-template-columns: repeat(var(--columns), minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.widget-column {
  display: grid;
  min-height: 180px;
  gap: 14px;
  align-content: start;
}

.widget-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--widget-color) 88%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

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

.widget-header {
  min-height: 46px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.42);
}

.widget-header h2 {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  font-size: 0.95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drag-handle {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.widget-actions {
  display: flex;
  gap: 4px;
}

.widget-actions button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  font-weight: 800;
}

.widget-body {
  padding: 12px;
}

.widget-body.collapsed {
  display: none;
}

.widget-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
}

.widget-footer button {
  min-height: 30px;
  padding: 0 9px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

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

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

.bookmark-list.compact {
  gap: 5px;
}

.bookmark-list a {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 8px 10px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.52);
  font-weight: 700;
  text-decoration: none;
}

.bookmark-list img {
  width: 18px;
  height: 18px;
}

.bookmark-list span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rss-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.rss-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rss-list,
.todo-list {
  display: grid;
  gap: 9px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.rss-list li {
  display: grid;
  gap: 3px;
}

.rss-list a {
  font-weight: 800;
  text-decoration: none;
}

.rss-list span,
.embed-note {
  color: var(--muted);
  font-size: 0.8rem;
}

.note-field {
  min-height: 168px;
  border: 1px dashed rgba(148, 163, 184, 0.55);
  background: rgba(255, 251, 235, 0.62);
  line-height: 1.45;
}

.todo-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 10px;
}

.todo-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.todo-list label {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.todo-list input {
  min-height: auto;
  width: auto;
}

.todo-list span {
  overflow-wrap: anywhere;
  font-weight: 650;
}

.todo-list .done {
  color: var(--muted);
  text-decoration: line-through;
}

.todo-list button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.16);
}

.embed-frame {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.embed-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.clock-face {
  display: grid;
  gap: 8px;
  place-items: start;
  padding: 10px 0;
}

.clock-face strong {
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1;
}

.clock-face span {
  font-weight: 800;
}

.clock-face small {
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(10px);
}

.modal,
.drawer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.modal {
  width: min(720px, 100%);
  padding: 18px;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
  width: min(430px, 100%);
  height: 100vh;
  padding: 18px;
  overflow-y: auto;
}

.widget-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.picker-card {
  display: grid;
  gap: 6px;
  min-height: 112px;
  padding: 14px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.picker-card strong {
  font-size: 1rem;
}

.picker-card span {
  color: var(--muted);
}

.settings-content {
  margin-top: 16px;
}

.settings-content form,
.import-export {
  display: grid;
  gap: 13px;
}

.settings-content label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 800;
}

.settings-content .check-row {
  display: flex;
  align-items: center;
}

.settings-content .check-row input {
  min-height: auto;
  width: auto;
}

.import-export {
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.empty-state {
  display: grid;
  min-height: 120px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: white;
  background: #111827;
  box-shadow: var(--shadow);
}

.hidden {
  display: none;
}

@media (max-width: 1050px) {
  .dashboard-canvas {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .top-actions {
    justify-content: space-between;
  }
}

@media (max-width: 680px) {
  .dashboard-page {
    padding-inline: 10px;
  }

  .dashboard-hero,
  .top-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .global-search,
  .inner-search,
  .todo-form {
    grid-template-columns: 1fr;
  }

  .dashboard-canvas,
  .widget-picker,
  .bookmark-list.grid {
    grid-template-columns: 1fr;
  }

  .privacy-toggle {
    justify-content: space-between;
  }

  .sync-status {
    display: none;
  }
}
