:root {
  --bg: #f5f1e8;
  --panel: rgba(255, 252, 245, 0.92);
  --panel-strong: #fffdf8;
  --border: rgba(47, 43, 35, 0.12);
  --border-strong: rgba(47, 43, 35, 0.24);
  --text: #231f19;
  --muted: #6d665c;
  --accent: #c85e3d;
  --accent-soft: rgba(200, 94, 61, 0.12);
  --danger: #8c2f1c;
  --shadow: 0 20px 60px rgba(63, 47, 24, 0.08);
  --radius: 24px;
  --radius-sm: 16px;
  --page-width: 1480px;
  font-family: "Segoe UI", "Malgun Gothic", sans-serif;
  color: var(--text);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(200, 94, 61, 0.16), transparent 32%),
    radial-gradient(circle at right center, rgba(48, 92, 140, 0.08), transparent 28%),
    var(--bg);
}

body {
  color: var(--text);
}

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

button {
  cursor: pointer;
  border: 0;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  width: min(calc(100% - 32px), var(--page-width));
  margin: 16px auto;
  padding: 8px 0 24px;
}

.sidebar,
.main {
  min-width: 0;
}

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

.brand-block,
.panel,
.drop-zone {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.brand-block {
  padding: 28px;
}

.brand-note-text {
  color: var(--accent);
  font-size: 0.79rem;
  line-height: 1.6;
  letter-spacing: 0.01em;
  font-weight: 700;
}

.storage-note {
  color: inherit;
  font-size: inherit;
  line-height: inherit;
  opacity: 0.9;
  font-weight: 400;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 3.2vw, 2.6rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.subtitle {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.panel {
  padding: 20px;
}

.panel-tight {
  padding: 18px 20px;
}

.stats-panel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stats-panel strong {
  display: block;
  margin-top: 8px;
  font-size: 1.5rem;
}

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

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

.date-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 340px);
  overflow: auto;
}

.view-mode-block {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.view-mode-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.view-mode-button {
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  color: var(--muted);
}

.view-mode-button.is-active {
  border-color: rgba(200, 94, 61, 0.34);
  background: rgba(200, 94, 61, 0.1);
  color: var(--accent);
}

.date-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid transparent;
  color: var(--text);
  transition: transform 120ms ease, border-color 120ms ease;
}

.date-button:hover,
.date-button:focus-visible {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  outline: none;
}

.date-button.is-active {
  border-color: rgba(200, 94, 61, 0.36);
  background: rgba(200, 94, 61, 0.08);
}

.date-button span:last-child {
  color: var(--muted);
}

.main {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 4px;
}

.hero h2 {
  font-size: clamp(1.8rem, 2.8vw, 2.8rem);
  letter-spacing: -0.03em;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.drop-zone {
  border-style: dashed;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.drop-zone.is-over {
  background: rgba(200, 94, 61, 0.08);
  border-color: rgba(200, 94, 61, 0.55);
  transform: translateY(-1px);
}

.input-label,
.field span,
.note-field span {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fffdf9;
  color: var(--text);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(200, 94, 61, 0.18);
  border-color: rgba(200, 94, 61, 0.48);
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button {
  padding: 11px 16px;
  border-radius: 999px;
  transition: transform 120ms ease, opacity 120ms ease, background-color 120ms ease;
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: var(--text);
  color: #fff;
}

.secondary-button {
  background: var(--panel-strong);
  border: 1px solid var(--border);
  color: var(--text);
}

.danger-button {
  background: rgba(140, 47, 28, 0.11);
  color: var(--danger);
}

.ghost-button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.toolbar-row {
  display: flex;
  align-items: end;
  gap: 14px;
  flex-wrap: wrap;
}

.field {
  min-width: 180px;
}

.search-field {
  flex: 1 1 320px;
}

.count-chip {
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(35, 31, 25, 0.06);
  color: var(--muted);
  font-size: 0.92rem;
}

.link-list {
  display: grid;
  gap: 14px;
}

.link-list.is-simple {
  gap: 8px;
}

.link-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--panel-strong);
}

.simple-link-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel-strong);
}

.simple-link-anchor {
  min-width: 0;
  flex: 1;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.simple-link-anchor:hover,
.simple-link-anchor:focus-visible {
  text-decoration: underline;
  outline: none;
}

.simple-delete-button {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(140, 47, 28, 0.16);
  background: rgba(140, 47, 28, 0.08);
  color: var(--danger);
}

.simple-link-item:hover,
.simple-link-item:focus-within {
  border-color: rgba(200, 94, 61, 0.28);
  background: rgba(200, 94, 61, 0.06);
}

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

.link-main {
  min-width: 0;
  flex: 1;
}

.badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.domain-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
}

.domain-badge {
  background: rgba(48, 92, 140, 0.09);
  color: #26486c;
}

.status-badge {
  background: var(--accent-soft);
  color: var(--accent);
}

.link-title {
  display: inline-block;
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  word-break: break-word;
}

.link-title:hover,
.link-title:focus-visible {
  text-decoration: underline;
}

.link-url {
  margin-top: 8px;
  color: var(--muted);
  word-break: break-all;
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.note-field {
  display: block;
  margin-top: 16px;
}

.meta-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.85rem;
}

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

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .date-list {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(calc(100% - 20px), var(--page-width));
    gap: 16px;
  }

  .hero {
    flex-direction: column;
  }

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

  .link-top {
    flex-direction: column;
  }

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