/* ── Reset & tokens ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Palette — blue/teal */
  --bg:           #f2f5f9;
  --surface:      #ffffff;
  --surface-2:    #f7f9fc;
  --border:       #dfe6ee;
  --border-focus: #1f80ab;
  --text:         #0c2340;
  --muted:        #51667b;
  --muted-light:  #8497a9;
  --primary:      #17698f;
  --primary-dark: #133556;
  --primary-2:    #1f80ab;
  --primary-bg:   #e8f2f8;
  --primary-border: #cfe6f1;
  --danger:       #dc2626;
  --danger-dark:  #b91c1c;
  --danger-bg:    #fdecec;
  --success:      #0f9d6a;
  --success-bg:   #e7f8f1;
  --warning-bg:   #fdf1e3;
  --warning:      #c8760a;
  --btn-bg: #0c2340;
  --gradient: var(--btn-bg);
  --success-border: #bbf7d0;
  --danger-border:  #fecaca;
  --danger-text:    #991b1b;
  --ics-bg: #e8f2f8; --ics-fg: #133556; --ics-border: #cfe6f1;
  --row-hover: #f4f8fb;
  color-scheme: light;

  /* Layout */
  --sidebar-w:  244px;
  --topbar-h:   52px;

  /* Shapes */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(12,35,64,.06), 0 1px 2px rgba(12,35,64,.04);
  --shadow:    0 1px 3px rgba(12,35,64,.06), 0 4px 12px rgba(12,35,64,.05);
  --shadow-md: 0 4px 16px rgba(12,35,64,.10), 0 1px 4px rgba(12,35,64,.06);
}

body {
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14.5px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body.has-nav { padding-top: var(--topbar-h); }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Topbar ── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .75rem;
  padding: 0 1.1rem;
  z-index: 200;
  box-shadow: var(--shadow-sm);
}
.topbar-brand {
  font-weight: 800; font-size: .95rem; letter-spacing: -.02em;
  color: var(--text);
}
.hamburger {
  background: none; border: none; font-size: 1.1rem;
  cursor: pointer; color: var(--muted); padding: .3rem .4rem; line-height: 1;
  border-radius: var(--radius-sm); transition: background .12s, color .12s;
  display: inline-flex; align-items: center; justify-content: center;
}
.hamburger .icon { width: 1.15rem; height: 1.15rem; }
.hamburger:hover { background: var(--bg); color: var(--text); }

/* ── Sidebar ── */
.sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform .2s cubic-bezier(.4,0,.2,1);
  z-index: 300; overflow-y: auto;
}
.sidebar.open { transform: translateX(0); }
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(12,35,64,.35);
  z-index: 299; backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }
.sidebar-close {
  background: none; border: none; cursor: pointer; color: var(--muted);
  font-size: .85rem; padding: .25rem .45rem; border-radius: var(--radius-sm);
  transition: background .12s; display: none;
  align-items: center; justify-content: center;
}
.sidebar-close .icon { width: 1rem; height: 1rem; }
.sidebar-close:hover { background: var(--bg); }

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1rem .9rem;
}
.sidebar-header .brand {
  font-weight: 800; font-size: .95rem; letter-spacing: -.02em;
  color: var(--text);
}

.sidebar-section { padding: .375rem .625rem; }
.sidebar-section + .sidebar-section {
  border-top: 1px solid var(--border);
  margin-top: .25rem; padding-top: .625rem;
}
.sidebar-label {
  font-size: .66rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted-light);
  padding: .2rem .5rem .35rem;
}
.sidebar-item {
  display: flex; align-items: center; gap: .55rem;
  padding: .42rem .6rem; font-size: .875rem; color: var(--muted);
  border-radius: var(--radius-sm); text-decoration: none;
  transition: background .12s, color .12s;
  white-space: nowrap; overflow: hidden; position: relative;
}
.sidebar-item:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.sidebar-item.active {
  background: var(--primary-bg); color: var(--primary); font-weight: 600;
}
.icon { width: 1em; height: 1em; display: inline-block; vertical-align: -.15em; flex-shrink: 0; }
.sidebar-icon { flex-shrink: 0; width: 1rem; height: 1rem; display: inline-flex; align-items: center; justify-content: center; opacity: .7; }
.sidebar-icon .icon { width: 1rem; height: 1rem; }
.sidebar-item.active .sidebar-icon { opacity: 1; }
.sidebar-text { overflow: hidden; text-overflow: ellipsis; }
.sidebar-add { color: var(--muted-light); font-size: .82rem; }
.sidebar-add:hover { color: var(--primary); }

.sidebar-footer {
  margin-top: auto; padding: .625rem .625rem .75rem;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem;
}
.sidebar-user {
  display: flex; align-items: center; gap: .5rem;
  padding: .38rem .55rem; border-radius: var(--radius-sm);
  color: var(--muted); font-size: .83rem; font-weight: 500;
  transition: background .12s, color .12s; flex: 1; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-user:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.sidebar-user.active { background: var(--primary-bg); color: var(--primary); }
.sidebar-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--gradient);
  color: #fff; font-size: .65rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; text-transform: uppercase;
}
.sidebar-logout {
  padding: .38rem .55rem; border-radius: var(--radius-sm);
  color: var(--muted); font-size: .83rem;
  transition: background .12s, color .12s;
  display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-logout .icon { width: 1rem; height: 1rem; }
.sidebar-logout:hover { background: var(--danger-bg); color: var(--danger); text-decoration: none; }

/* Desktop sidebar always visible */
@media (min-width: 768px) {
  .sidebar { transform: translateX(0); }
  .sidebar-close { display: none !important; }
  .sidebar-overlay { display: none !important; }
  body.has-nav .page-wrap { margin-left: var(--sidebar-w); }
  .hamburger { display: none; }
}
@media (max-width: 767px) {
  .sidebar-close { display: inline-flex; }
}

/* ── Main ── */
main {
  max-width: 920px;
  margin: 2.25rem auto;
  padding: 0 1.5rem;
}
@media (max-width: 480px) {
  main { margin: 1.5rem auto; padding: 0 1rem; }
}

/* ── Flash messages ── */
.flash {
  display: flex; align-items: flex-start; gap: .65rem;
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .875rem;
  border: 1px solid transparent;
}
.flash::before { font-size: 1rem; flex-shrink: 0; }
.flash-success {
  background: var(--success-bg); color: var(--success);
  border-color: var(--success-border);
}
.flash-success::before { content: "✓"; }
.flash-error {
  background: var(--danger-bg); color: var(--danger);
  border-color: var(--danger-border);
}
.flash-error::before { content: "✕"; }

/* ── Back link ── */
.back-link {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .82rem; font-weight: 600; color: var(--muted);
  margin-bottom: .9rem;
}
.back-link:hover { color: var(--primary); text-decoration: none; }
.back-link .icon { width: .85rem; height: .85rem; }

/* ── Page header ── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.75rem; gap: 1rem; flex-wrap: wrap;
}
.page-header h2 {
  font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; color: var(--text);
}

/* ── Calendar hero (calendar detail page header) ── */
.cal-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.5rem 1.1rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.cal-hero-head {
  display: flex; align-items: baseline; gap: .6rem 1.25rem;
  flex-wrap: wrap; margin-bottom: .9rem;
}
.cal-hero-head h2 {
  font-size: 1.2rem; font-weight: 700; letter-spacing: -.02em;
}
.cal-hero-slug {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: .78rem; color: var(--muted);
}
.cal-hero-links {
  display: flex; flex-wrap: wrap; gap: .5rem;
}
.url-chip {
  display: inline-flex; align-items: stretch;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; font-size: .775rem; background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.url-chip-label {
  padding: .3rem .6rem;
  background: var(--surface-2); color: var(--muted);
  border-right: 1px solid var(--border);
  font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  display: flex; align-items: center; white-space: nowrap;
}
.url-chip-url {
  padding: .3rem .65rem; color: var(--text);
  font-family: ui-monospace, monospace; font-size: .75rem;
  max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: flex; align-items: center;
}
.url-chip-btn {
  padding: .3rem .55rem;
  border: none; border-left: 1px solid var(--border);
  background: none; cursor: pointer; font-size: .75rem;
  color: var(--muted); display: flex; align-items: center;
  transition: background .12s, color .12s; white-space: nowrap;
  font-family: inherit;
}
.url-chip-btn:hover { background: var(--bg); color: var(--primary); }
.url-chip-btn.is-link { text-decoration: none; }
.url-chip-btn.is-link:hover { text-decoration: none; }

@media (max-width: 560px) {
  .url-chip { display: flex; width: 100%; }
  .url-chip-url { flex: 1; max-width: none; min-width: 0; }
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .48rem 1rem;
  background: var(--gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .85rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: box-shadow .15s, transform .1s, filter .15s;
  white-space: nowrap; line-height: 1.4;
  box-shadow: 0 1px 2px rgba(12,35,64,.25);
}
.btn:hover {
  filter: brightness(1.06); color: #fff; text-decoration: none;
  box-shadow: 0 4px 14px rgba(12,35,64,.30);
}
.btn:active { transform: scale(.98); }
.btn-sm { padding: .3rem .65rem; font-size: .78rem; }
.btn-ghost {
  background: transparent; color: var(--muted); box-shadow: none;
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); box-shadow: none; }
.btn-secondary {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--surface-2); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-danger { background: var(--danger); box-shadow: 0 1px 2px rgba(220,38,38,.15); }
.btn-danger:hover { background: var(--danger-dark); box-shadow: 0 2px 6px rgba(220,38,38,.25); }

/* ── Dashboard stat tiles ── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .9rem;
  margin-bottom: 1.75rem;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
}
.stat .stat-n { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--text); }
.stat .stat-l { font-size: .75rem; color: var(--muted); margin-top: .15rem; }
@media (max-width: 640px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}

/* ── Dashboard calendar cards ── */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.cal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, transform .15s, border-color .15s;
  display: flex; flex-direction: column;
  overflow: hidden;
  text-decoration: none; color: inherit;
}
.cal-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--primary-border); text-decoration: none; }
.cal-card-body { padding: 1.2rem 1.35rem .9rem; flex: 1; }
.cal-card-title { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: .15rem; }
.cal-card-slug {
  font-family: ui-monospace, monospace; font-size: .72rem;
  color: var(--muted); margin-bottom: .85rem;
}
.cal-card-stats {
  display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: .5rem;
}
.cal-stat {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .75rem; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 99px; padding: .15em .6em;
}
.cal-stat-icon { display: inline-flex; opacity: .7; }
.cal-stat-icon .icon { width: .8rem; height: .8rem; }
.cal-badge {
  display: inline-flex; align-items: center;
  font-size: .68rem; font-weight: 700;
  border-radius: 99px; padding: .15em .6em;
  letter-spacing: .03em; white-space: nowrap;
}
.cal-badge-ics { background: var(--ics-bg); color: var(--ics-fg); border: 1px solid var(--ics-border); }
.cal-badge-viewer { background: var(--primary-bg); color: var(--primary); border: 1px solid var(--primary-border); }
.cal-card-footer {
  padding: .7rem 1.35rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem;
}

/* Legacy card styles (keep for other pages) */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem 1.1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, transform .15s;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.card h3 { font-size: .97rem; font-weight: 600; margin-bottom: .2rem; }
.card .slug {
  color: var(--muted); font-size: .78rem; margin-bottom: .9rem;
  font-family: ui-monospace, monospace;
}

/* ── Landing page ── */
body:has(.landing-hero) {
  background: var(--bg);
  min-height: 100vh;
}
.landing-hero {
  max-width: 560px; margin: 4.5rem auto 3rem; text-align: center;
}
.landing-logo {
  width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 1.25rem;
  background: var(--gradient); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.landing-logo .icon { width: 32px; height: 32px; }
.landing-hero h1 { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; margin-bottom: .5rem; }
.landing-tagline { color: var(--muted); font-size: 1.02rem; line-height: 1.55; margin-bottom: 1.75rem; }
.landing-actions .btn { padding: .65rem 1.5rem; font-size: .9rem; }
.landing-features {
  max-width: 860px; margin: 0 auto 3rem;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem;
}
.landing-feature {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem 1.35rem; box-shadow: var(--shadow-sm);
}
.landing-feature-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--primary-bg); color: var(--primary); margin-bottom: .9rem;
}
.landing-feature-icon .icon { width: 1.15rem; height: 1.15rem; }
.landing-feature h3 { font-size: .95rem; font-weight: 700; margin-bottom: .35rem; }
.landing-feature p { font-size: .84rem; color: var(--muted); line-height: 1.5; }
@media (max-width: 700px) {
  .landing-features { grid-template-columns: 1fr; }
  .landing-hero { margin-top: 2.5rem; }
}

/* ── Auth card ── */
body:has(.auth-card) {
  background: var(--bg);
  min-height: 100vh;
}
.auth-card {
  max-width: 380px;
  margin: 5rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem;
  box-shadow: var(--shadow-md);
  text-align: center;
}
@media (max-width: 480px) {
  .auth-card { margin: 2.5rem auto; padding: 1.75rem 1.35rem; }
}
.auth-card .auth-logo {
  width: 48px; height: 48px; border-radius: 14px; margin: 0 auto 1rem;
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.auth-card .auth-logo .icon { width: 24px; height: 24px; }
.auth-card h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: .2rem; }
.auth-card .tagline { color: var(--muted); font-size: .875rem; margin-bottom: 1.75rem; }
.auth-card form { text-align: left; }

/* ── Forms ── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  max-width: 640px;
  box-shadow: var(--shadow-sm);
}
.form-card + .form-card { margin-top: .875rem; }

label {
  display: block; font-size: .82rem; font-weight: 600;
  margin-bottom: .3rem; margin-top: 1rem; color: var(--text);
}
label:first-child { margin-top: 0; }

input[type=text], input[type=url], input[type=email], input[type=search],
input[type=password], input[type=number], select, textarea {
  width: 100%;
  padding: .5rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(31,128,171,.20);
}
input[disabled] { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
textarea { resize: vertical; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: .75rem;
}
.form-row label { margin-top: 0; }
.form-row > div { margin-top: 1rem; }
.checkbox-label {
  display: flex; align-items: center; gap: .55rem;
  font-size: .875rem; font-weight: 400; margin-top: .9rem;
  cursor: pointer;
}
.checkbox-label input[type=checkbox] {
  width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer;
}
.hint { font-size: .8rem; color: var(--muted); margin-top: .3rem; line-height: 1.45; }
form .btn { margin-top: 1.35rem; }

fieldset {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.1rem;
  margin-bottom: 1rem;
}
legend {
  font-size: .75rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  padding: 0 .4rem;
}

/* ── Tabs — underline style ── */
.tabs {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: .55rem 1rem;
  font-size: .85rem; font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer; text-decoration: none;
  transition: color .12s, border-color .12s;
  white-space: nowrap;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active {
  color: var(--primary); border-bottom-color: var(--primary); font-weight: 600;
}
.tab-panel.hidden { display: none; }

/* ── Section header ── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .875rem; gap: .75rem; flex-wrap: wrap;
}
.section-header h3 { font-size: .95rem; font-weight: 600; }

/* ── Tables ── */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: .875rem;
}
th {
  text-align: left;
  padding: .6rem 1rem;
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--row-hover); }
.url-cell {
  max-width: 280px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}

.row-user { display: inline-flex; align-items: center; white-space: nowrap; }
.row-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: var(--gradient); color: #fff;
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  margin-right: .55rem;
}

code {
  font-family: ui-monospace, "Cascadia Code", "Fira Code", monospace;
  font-size: .8rem; background: var(--surface-2);
  border: 1px solid var(--border);
  padding: .1em .4em; border-radius: 4px; color: var(--primary);
}

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  padding: .18em .6em;
  border-radius: 99px;
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap;
}
.badge-include, .badge-active {
  background: var(--success-bg); color: var(--success);
  border: 1px solid var(--success-border);
}
.badge-exclude {
  background: var(--danger-bg); color: var(--danger);
  border: 1px solid var(--danger-border);
}
.badge-disabled {
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border);
}

/* ── Feed URL box (Views tab) ── */
.feed-url-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin-bottom: 1rem;
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  font-size: .85rem;
}
.feed-url-box strong { color: var(--muted); font-weight: 600; white-space: nowrap; }
.feed-url-box code {
  background: none; border: none; flex: 1;
  min-width: 180px; word-break: break-all; color: var(--text);
}

/* ── Empty state ── */
.empty-state {
  text-align: center; padding: 4rem 1rem;
  color: var(--muted);
}
.empty-state .empty-icon {
  margin-bottom: .75rem; opacity: .5;
  display: flex; justify-content: center;
}
.empty-state .empty-icon .icon { width: 2.75rem; height: 2.75rem; stroke-width: 1.25; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: .35rem; }
.empty-state p { font-size: .875rem; max-width: 380px; margin: 0 auto .25rem; }
.empty-state .empty-hint { color: var(--muted); font-size: .82rem; margin-bottom: 1.35rem; }
.empty {
  color: var(--muted); font-size: .875rem; padding: .6rem 0;
  display: flex; align-items: center; gap: .4rem;
}

/* ── Danger zone ── */
.danger-zone {
  background: var(--danger-bg);
  border: 1.5px solid var(--danger-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
}
.danger-zone h3 { font-size: .95rem; font-weight: 600; color: var(--danger); margin-bottom: .35rem; }
.danger-zone p { font-size: .85rem; color: var(--danger-text); margin-bottom: .9rem; }

/* ── Sharing form ── */
.form-card-title {
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); margin-bottom: .75rem;
}
.link-row { display: flex; gap: .5rem; margin-bottom: .4rem; flex-wrap: wrap; }
.link-row input { flex: 1; min-width: 140px; margin-top: 0; }

/* ── Row actions ── */
.row-actions { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.row-actions form { display: inline-flex; }

/* ── Inline info box ── */
.info-box {
  background: var(--primary-bg);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius);
  padding: .65rem .9rem;
  font-size: .83rem;
  color: var(--primary-dark);
  margin-top: .5rem;
  display: flex; align-items: flex-start; gap: .5rem; flex-wrap: wrap;
}

/* ── Count chip ── */
.count-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.35rem; height: 1.35rem;
  background: var(--primary-bg); color: var(--primary);
  border-radius: 99px; font-size: .7rem; font-weight: 700;
  margin-left: .35rem;
}

.cal-card-activity { font-size: .74rem; color: var(--muted); margin-top: .5rem; }
.cal-hero-activity { font-size: .78rem; color: var(--muted); margin-left: .6rem; }
/* ── Dark theme (brand navy ground) ── */
:root[data-theme="dark"] {
  --bg:#0c2340; --surface:#133556; --surface-2:#0f2b49; --border:#234a6d;
  --border-focus:#7cc4e8; --text:#f2f5f9; --muted:#a9bdd0; --muted-light:#7a94ab;
  --primary:#7cc4e8; --primary-dark:#a9dcf3; --primary-2:#5db4dd;
  --primary-bg:#153d5f; --primary-border:#2f5b82; --btn-bg:#17698f;
  --danger:#f26868; --danger-dark:#e04a4a; --danger-bg:#3a1c26;
  --success:#34d399; --success-bg:#0f3a35; --warning-bg:#3a3018; --warning:#f0a33a;
  --success-border:#1f5a4c; --danger-border:#6a2c3a; --danger-text:#f4a3a3;
  --ics-bg:#153d5f; --ics-fg:#a9dcf3; --ics-border:#2f5b82; --row-hover:#17395c;
  --shadow-sm:0 1px 3px rgba(0,0,0,.4); --shadow:0 4px 12px rgba(0,0,0,.35); --shadow-md:0 6px 20px rgba(0,0,0,.45);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#0c2340; --surface:#133556; --surface-2:#0f2b49; --border:#234a6d;
    --border-focus:#7cc4e8; --text:#f2f5f9; --muted:#a9bdd0; --muted-light:#7a94ab;
    --primary:#7cc4e8; --primary-dark:#a9dcf3; --primary-2:#5db4dd;
    --primary-bg:#153d5f; --primary-border:#2f5b82; --btn-bg:#17698f;
    --danger:#f26868; --danger-dark:#e04a4a; --danger-bg:#3a1c26;
    --success:#34d399; --success-bg:#0f3a35; --warning-bg:#3a3018; --warning:#f0a33a;
    --success-border:#1f5a4c; --danger-border:#6a2c3a; --danger-text:#f4a3a3;
    --ics-bg:#153d5f; --ics-fg:#a9dcf3; --ics-border:#2f5b82; --row-hover:#17395c;
    --shadow-sm:0 1px 3px rgba(0,0,0,.4); --shadow:0 4px 12px rgba(0,0,0,.35); --shadow-md:0 6px 20px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}

/* ── Theme toggle, toast, search, shortcuts ── */
.theme-toggle {
  background: none; border: none; cursor: pointer; color: var(--muted);
  padding: .35rem; border-radius: var(--radius-sm); display: inline-flex;
  align-items: center; justify-content: center; transition: background .12s, color .12s;
}
.theme-toggle:hover { background: var(--bg); color: var(--text); }
.theme-toggle .icon { width: 1rem; height: 1rem; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: inline-block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
.topbar-spacer { flex: 1; }

.toast-host { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: .5rem; pointer-events: none; }
.toast {
  background: var(--text); color: var(--surface); padding: .55rem 1rem; border-radius: 99px;
  font-size: .85rem; font-weight: 500; box-shadow: var(--shadow-md);
  animation: toast-in .18s ease-out; display: flex; align-items: center; gap: .45rem;
}
.toast.out { opacity: 0; transition: opacity .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.dash-tools { display: flex; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.dash-search { position: relative; flex: 1; max-width: 380px; }
.dash-search input[type="search"] { width: 100%; padding: .55rem 2.4rem .55rem 2.1rem; }
.dash-search .icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); width: .95rem; height: .95rem; color: var(--muted-light); pointer-events: none; }
.dash-search kbd { position: absolute; right: .6rem; top: 50%; transform: translateY(-50%); }
kbd {
  font: 600 .68rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 4px; padding: .2rem .38rem;
}
.cal-card-url { display: flex; align-items: center; gap: .4rem; margin-top: .65rem; }
.cal-card-url code {
  flex: 1; min-width: 0; font-size: .72rem; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .25rem .5rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-badge-warn { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning); }
.no-results { text-align: center; color: var(--muted); padding: 2rem 0; display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Accessibility ── */
main:focus { outline: none; }
:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.btn:focus-visible, .sidebar-item:focus-visible, .tab:focus-visible { outline-offset: 1px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .cal-card:hover { transform: none; }
}

.dash-sort select { width: auto; padding: .5rem 2rem .5rem .75rem; font-size: .85rem; }
@media (max-width: 600px) { .dash-tools { flex-wrap: wrap; } }

.import-summary { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; padding: 0; }
.import-sources { padding-left: 1.1rem; font-size: .82rem; overflow-wrap: anywhere; }
.import-warning { margin-top: .9rem; padding: .65rem .9rem; font-size: .875rem; background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning); border-radius: var(--radius-sm); }
/* ── Brand type: Plus Jakarta Sans, 800 headings / 700 labels / 500 body ── */
body { font-weight: 500; }
h1, h2, h3 { font-weight: 800; letter-spacing: -.01em; }
.btn, .tab.active, .form-card-title, .page-header h2 { font-weight: 700; }
.totp-secret { display: inline-block; padding: .5rem .75rem; font-size: 1rem; letter-spacing: .08em; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); user-select: all; word-break: break-all; }
.recovery-codes { margin: .6rem 0 1rem; padding: .75rem 1rem; font: 600 .95rem/1.7 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); user-select: all; }

.activity-table td { vertical-align: top; font-size: .84rem; overflow-wrap: anywhere; }
.activity-table td:first-child { white-space: nowrap; color: var(--muted); }
.act { font-weight: 700; }
.act-login, .act-logout { color: var(--primary); }
.act-2fa, .act-password, .act-token, .act-admin { color: var(--warning); }
.activity-pager { display: flex; gap: .5rem; margin-top: 1rem; }
.totp-qr { display: inline-block; padding: .5rem; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); line-height: 0; }
.totp-qr svg { width: 200px; height: 200px; display: block; }
