:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #fffefd;
  --text: #1d2433;
  --muted: #68748a;
  --line: #dde6f2;
  --accent: #eb541e;
  --accent-dark: #b83d12;
  --accent-soft: #fde7dd;
  --teal: #f2a064;
  --yellow: #f3b43f;
  --danger: #d64b5f;
  --shadow: 0 18px 55px rgba(31, 45, 80, 0.10);
  --radius: 24px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #fde7dd;
  color: var(--text);
}

.app {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

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

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

h1, h2, h3 { margin: 0; line-height: 1.08; }
h1 { font-size: clamp(2.4rem, 6vw, 5rem); letter-spacing: -0.06em; }
h2 { font-size: 1.35rem; letter-spacing: -0.035em; }
h3 { font-size: 1rem; }

.subtitle {
  margin: 12px 0 0;
  max-width: 690px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.45;
}

.hero-actions,
.dialog-actions,
.links-head {
  display: flex;
  gap: 10px;
  align-items: center;
}
.hero-actions { align-items: end; }
.hero-actions label { margin: 0; }
.hero-search span { display: none; }
.hero-actions label span {
  margin-bottom: 6px;
  color: rgba(104, 116, 138, 0.72);
  font-size: 0.72rem;
}
.hero-actions input,
.hero-actions select {
  height: 38px;
  border-color: rgba(235, 84, 30, 0.06);
  background: rgba(255, 244, 238, 0.58);
  border-radius: 999px;
  padding: 8px 13px;
  color: rgba(184, 61, 18, 0.78);
}
.hero-search { width: min(260px, 26vw); }
.hero-category { width: min(190px, 20vw); }
.hero-category select { color: rgba(29, 36, 51, 0.82); }

.panel,
dialog::backdrop + * {
  background: rgba(255, 254, 253, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 14px;
  padding: 18px;
  margin-bottom: 20px;
}

label span {
  display: block;
  margin-bottom: 8px;
  font-weight: 760;
  letter-spacing: -0.015em;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  background: #fff;
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

textarea { resize: vertical; line-height: 1.45; }

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(235, 84, 30, 0.62);
  box-shadow: 0 0 0 4px rgba(235, 84, 30, 0.11);
  background: #fffefc;
}

button,
.button-like {
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 780;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, opacity 120ms ease;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover,
.button-like:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }

.primary { color: #fff; background: var(--accent); }
.primary:hover { background: var(--accent-dark); }
.hero-actions .primary {
  height: 38px;
  padding: 0 16px;
  background: rgba(255, 244, 238, 0.58);
  border: 1px solid rgba(235, 84, 30, 0.06);
  color: rgba(184, 61, 18, 0.78);
}
.hero-actions .primary:hover { background: rgba(255, 254, 253, 0.9); color: var(--accent-dark); }
.ghost { background: var(--accent-soft); color: var(--accent-dark); }
.square {
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 1.15rem;
  line-height: 1;
}
.hero-actions .square {
  background: rgba(255, 244, 238, 0.58);
  border: 1px solid rgba(235, 84, 30, 0.06);
  color: rgba(184, 61, 18, 0.68);
}
.hero-actions .square:hover { background: rgba(255, 254, 253, 0.9); color: var(--accent-dark); }
.small { padding: 8px 12px; font-size: 0.92rem; }
.danger { color: #a32238; background: #ffe7eb; }
.spacer { flex: 1; }

.dashboard { display: grid; gap: 24px; }
.category-section { display: grid; gap: 12px; }
.category-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.category-title::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 5px rgba(242, 160, 100, 0.16);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 14px;
}

.card {
  position: relative;
  background: rgba(255, 254, 253, 0.92);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 14px 36px rgba(31, 45, 80, 0.08);
  padding: 13px;
  display: grid;
  gap: 8px;
}

.card-top {
  display: flex;
  gap: 12px;
  align-items: start;
  padding-right: 26px;
}
.icon-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
}

.icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent-soft), #fffaf7);
  font-size: 1.55rem;
}
.title-button {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  text-align: left;
  white-space: normal;
  text-decoration: none;
  cursor: pointer;
}
.title-button:hover { transform: none; color: var(--accent); }
.card p { margin: 5px 0 0; color: var(--muted); line-height: 1.42; font-size: 0.94rem; }

.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card-actions button { padding: 9px 12px; font-size: 0.92rem; }
.settings-button {
  position: absolute;
  right: 7px;
  bottom: 6px;
  z-index: 2;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1;
  box-shadow: none;
  opacity: 0.58;
}
.settings-button:hover { transform: none; color: var(--accent); background: var(--accent-soft); opacity: 1; }

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.empty strong { color: var(--text); }

dialog {
  border: 0;
  padding: 0;
  background: transparent;
  width: min(760px, calc(100% - 24px));
}

dialog::backdrop { background: rgba(18, 27, 46, 0.42); backdrop-filter: blur(4px); }

.dialog-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  gap: 16px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  background: #eef2f8;
  color: var(--muted);
  font-size: 1.25rem;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.icon-row { align-items: end; grid-template-columns: 110px 1fr; }
.icon-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-picker button { width: 42px; height: 42px; padding: 0; background: #eef2f8; font-size: 1.2rem; }

.links-head { justify-content: space-between; margin-top: 4px; }
.links-editor { display: grid; gap: 10px; }
.link-row { display: grid; grid-template-columns: minmax(0, 1fr) 38px; gap: 8px; }
.category-editor { display: grid; gap: 10px; }
.category-row { display: grid; grid-template-columns: 38px 38px minmax(0, 1fr) 38px; gap: 8px; align-items: center; }
.move-category {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  background: #eef2f8;
  color: var(--muted);
  font-size: 1rem;
}
.hint { margin: 0; color: var(--muted); font-size: 0.91rem; line-height: 1.42; }

@media (max-width: 760px) {
  .app { width: min(100% - 24px, 1180px); padding: 26px 0; }
  .hero { align-items: start; flex-direction: column; }
  .hero-actions { width: 100%; flex-wrap: wrap; }
  .hero-search, .hero-category { width: 100%; }
  .toolbar, .form-grid, .icon-row, .link-row { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .dialog-card { padding: 18px; }
  .dialog-actions { flex-wrap: wrap; }
  .spacer { display: none; }
}
