/*
  Design tokens for Satchel and sister apps.
  Keep every custom property in step with tokens.ts.
  Generated from Satchel packages/theme/src/tokens.ts and tokens.css.
*/

:root {
  --font: 'Red Hat Display', 'Segoe UI', 'SF Pro Text', 'Helvetica Neue', sans-serif;
  --wordmark-font: 'Red Hat Display', sans-serif;
  --mono: 'Cascadia Mono', 'SF Mono', ui-monospace, monospace;
  --sidebar: 252px;
  --list: 392px;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-control: 7px;
  --radius-card: 10px;
  --radius-dialog: 14px;
  --radius-pill: 999px;
  --row: 72px;
  --titlebar-height: 40px;
  --titlebar-mac-inset: 78px;
  --titlebar-mark-size: 28px;
  --titlebar-wordmark-size: 13.5px;
  --control-height: 30px;
  --font-size: 13.5px;
  --letter-spacing: 0.005em;
  --btn-radius: 7px;
  --btn-radius-primary: 8px;
  --btn-border-width: 0;
  --btn-border-width-secondary: 1px;
  --btn-height: 30px;
  --btn-height-sm: 28px;
  --btn-padding: 0 10px;
  --btn-padding-primary: 6px 10px;
  --btn-gap: 6px;
  --btn-font: 'Red Hat Display', 'Segoe UI', 'SF Pro Text', 'Helvetica Neue', sans-serif;
  --btn-font-size: 13.5px;
  --btn-font-weight: 400;
  --btn-font-weight-primary: 650;
  --btn-letter-spacing: 0.005em;
  --btn-shadow: none;
  --btn-focus-width: 2px;
  --btn-focus-offset: 1px;
  --btn-disabled-opacity: 0.45;
  --btn-primary-hover-filter: brightness(1.05);
  --btn-primary-pressed-filter: brightness(1.05);
  --btn-icon-size: 28px;
  --btn-icon-glyph: 16px;
  --statusbar-height: 32px;
  --statusbar-pad-y: 4px;
  --statusbar-pad-left: 17px;
  --statusbar-pad-right: 12px;
  --statusbar-gap: 12px;
  --tabbar-height: 32px;
  --tabbar-pad-x: 10px;
  --tabbar-gap: 4px;
  --tab-height: 26px;
  --tab-pad-x: 12px;
  --tab-gap: 8px;
  --tab-max-width: 240px;
  --tab-radius: 8px 8px 0 0;
  --toolbar-min-height: 68px;
  --toolbar-pad: 6px 8px 8px;
  --toolbar-gap: 2px;
  --wincontrol-width: 28px;
  --wincontrol-height: 28px;
  --wincontrol-icon-size: 12px;
}

:root,
[data-theme='light'] {
  --bg-app: #e6e1d6;
  --bg-sidebar: #efeae0;
  --bg-list: #f6f3ec;
  --bg-read: #fffcf7;
  --bg-toolbar: #f3eee6;
  --bg-tab: #e3ddd2;
  --bg-tab-active: #f6f3ec;
  --bg-hover: rgba(42, 34, 22, 0.055);
  --bg-selected: #e3f1ef;
  --bg-chip: rgba(42, 34, 22, 0.06);
  --bg-inset: #fffdf9;
  --line: rgba(42, 34, 22, 0.12);
  --line-strong: rgba(42, 34, 22, 0.2);
  --ink: #1d1a16;
  --ink-muted: #6e665c;
  --ink-faint: #90877c;
  --accent: #0e6e6a;
  --accent-ink: #f4fffe;
  --danger: #a33b32;
  --star: #c4892a;
  --shadow: 0 10px 30px rgba(60, 42, 20, 0.12);
  --mark: #143633;
  --brand-mark: #1D4834;
  --icon-line: #1D4834;
  --icon-accent: #B9CFB0;
  --icon-bg: #FFFFFF;
  --btn-ghost-fill: transparent;
  --btn-ghost-text: #1d1a16;
  --btn-ghost-border: transparent;
  --btn-ghost-fill-hover: rgba(42, 34, 22, 0.055);
  --btn-ghost-text-hover: #1d1a16;
  --btn-ghost-fill-pressed: rgba(42, 34, 22, 0.055);
  --btn-ghost-text-pressed: #1d1a16;
  --btn-primary-fill: #0e6e6a;
  --btn-primary-text: #f4fffe;
  --btn-primary-border: transparent;
  --btn-primary-fill-hover: #0e6e6a;
  --btn-primary-text-hover: #f4fffe;
  --btn-primary-fill-pressed: #0e6e6a;
  --btn-primary-text-pressed: #f4fffe;
  --btn-secondary-fill: #e6e1d6;
  --btn-secondary-text: #1d1a16;
  --btn-secondary-border: rgba(42, 34, 22, 0.12);
  --btn-secondary-fill-hover: rgba(42, 34, 22, 0.055);
  --btn-secondary-text-hover: #1d1a16;
  --btn-secondary-fill-pressed: rgba(42, 34, 22, 0.055);
  --btn-secondary-text-pressed: #1d1a16;
  --btn-focus-color: #0e6e6a;
  --btn-icon-fill: transparent;
  --btn-icon-fill-hover: rgba(42, 34, 22, 0.055);
  color-scheme: light;
}

[data-theme='dark'] {
  --bg-app: #12110f;
  --bg-sidebar: #181715;
  --bg-list: #1e1d1a;
  --bg-read: #25231f;
  --bg-toolbar: #1b1a17;
  --bg-tab: #141311;
  --bg-tab-active: #1e1d1a;
  --bg-hover: rgba(255, 246, 230, 0.05);
  --bg-selected: #1c3331;
  --bg-chip: rgba(255, 246, 230, 0.06);
  --bg-inset: #2c2a26;
  --line: rgba(255, 246, 230, 0.1);
  --line-strong: rgba(255, 246, 230, 0.18);
  --ink: #f3eee6;
  --ink-muted: #b3aa9e;
  --ink-faint: #877f74;
  --accent: #3cbeb6;
  --accent-ink: #062221;
  --danger: #e07a72;
  --star: #e2b15a;
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  --mark: #d7ebe8;
  --brand-mark: #CFE3C8;
  --icon-line: #CFE3C8;
  --icon-accent: #4F7A5E;
  --icon-bg: #1E2A24;
  --btn-ghost-fill: transparent;
  --btn-ghost-text: #f3eee6;
  --btn-ghost-border: transparent;
  --btn-ghost-fill-hover: rgba(255, 246, 230, 0.05);
  --btn-ghost-text-hover: #f3eee6;
  --btn-ghost-fill-pressed: rgba(255, 246, 230, 0.05);
  --btn-ghost-text-pressed: #f3eee6;
  --btn-primary-fill: #267a74;
  --btn-primary-text: #f4fffe;
  --btn-primary-border: transparent;
  --btn-primary-fill-hover: #267a74;
  --btn-primary-text-hover: #f4fffe;
  --btn-primary-fill-pressed: #267a74;
  --btn-primary-text-pressed: #f4fffe;
  --btn-secondary-fill: #12110f;
  --btn-secondary-text: #f3eee6;
  --btn-secondary-border: rgba(255, 246, 230, 0.1);
  --btn-secondary-fill-hover: rgba(255, 246, 230, 0.05);
  --btn-secondary-text-hover: #f3eee6;
  --btn-secondary-fill-pressed: rgba(255, 246, 230, 0.05);
  --btn-secondary-text-pressed: #f3eee6;
  --btn-focus-color: #3cbeb6;
  --btn-icon-fill: transparent;
  --btn-icon-fill-hover: rgba(255, 246, 230, 0.05);
  color-scheme: dark;
}
/* Search / Theme / Settings cluster. Copied from Satchel's toolbar styles. */

.toolbar-pinned { display: inline-flex; align-items: center; gap: 2px; }

.icon-action {
  height: auto;
  min-width: 54px;
  padding: 2px 3px 1px;
  border: 0;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.15;
  background: transparent;
}
.icon-action svg { width: 24px; height: 24px; }
.icon-action:hover { background: var(--bg-hover); }
.icon-action:disabled { opacity: 0.38; }
.icon-action.selected,
.icon-action[aria-pressed='true'] { background: var(--bg-selected); color: var(--accent); }
.icon-action:active { background: var(--bg-hover); filter: brightness(0.96); }
.icon-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.keel-toolbar {
  display: flex;
  align-items: flex-end;
  gap: var(--toolbar-gap);
  min-height: var(--toolbar-min-height);
  padding: var(--toolbar-pad);
  background: var(--bg-toolbar);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.toolbar-spacer { flex: 1; }
.toolbar-sep {
  width: 18px;
  align-self: stretch;
  display: inline-flex;
  align-items: stretch;
  justify-content: center;
  flex: none;
}
.toolbar-sep i { width: 1px; background: var(--line-strong); margin: 8px 0; }
.toolbar-space { width: 18px; align-self: stretch; flex: none; }

.theme-switch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 54px;
  padding: 2px 3px 1px;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.15;
}
.theme-switch-track {
  position: relative;
  width: 48px;
  height: 24px;
  box-sizing: border-box;
  border: 1.5px solid var(--icon-line);
  border-radius: 999px;
  background: var(--icon-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  color: var(--icon-line);
}
.theme-switch-track:hover { background: var(--bg-hover); }
.theme-switch-track:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.theme-switch-track svg {
  width: 13px;
  height: 13px;
  position: relative;
  z-index: 1;
}
.theme-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--icon-accent);
  transition: transform 160ms ease;
}
.theme-switch-track[aria-checked='true'] .theme-switch-knob {
  transform: translateX(23px);
}

.keel-wordmark {
  font-family: 'Red Hat Display', sans-serif;
  font-weight: 900;
  font-variation-settings: 'wght' 900;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--brand-mark, #1D4834);
  line-height: 1;
}

.keel-status-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.keel-status-brand .keel-wordmark { font-size: 12px; }

.keel-status {
  box-sizing: border-box;
  height: var(--statusbar-height);
  flex: none;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: var(--statusbar-pad-y) var(--statusbar-pad-right) var(--statusbar-pad-y) var(--statusbar-pad-left);
  border-top: 1px solid var(--line);
  background: var(--bg-toolbar);
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 400;
}
.keel-status-start {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: none;
}
.keel-status-spacer { flex: 1; min-width: 8px; }
.keel-status-end {
  display: inline-flex;
  align-items: center;
  gap: var(--statusbar-gap);
  flex: none;
}
.status-pill {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  height: calc(var(--statusbar-height) - 2 * var(--statusbar-pad-y));
  border-radius: var(--radius-pill);
}

.keel-filepicker {
  box-sizing: border-box;
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--control-height);
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--bg-inset);
  color: var(--ink);
}
.keel-filepicker-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.keel-filepicker .kd-btn { flex: none; }
.keel-filepicker .kd-btn:focus-visible { outline: none; }
.keel-filepicker:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.keel-filepicker--drag {
  background: var(--bg-hover);
  border-color: var(--accent);
}
.keel-filepicker--disabled { opacity: var(--btn-disabled-opacity); }
.keel-filepicker-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-muted);
  font-size: var(--font-size);
}
.keel-filepicker-name--empty { color: var(--ink-faint); }
/*
  Dialog and icon buttons from Satchel main.
  Geometry and states: packages/desktop/src/renderer/styles/chrome.css
  (.tool / .keel-button, .tool.primary, .icon-button / .keel-icon-button)
  and packages/desktop/src/renderer/styles/app.css
  (.tool.primary radius and padding, .tool:disabled, .tool.icon-tool,
  .account-actions .tool).
  Satchel sets no button shadow and no separate :active color.
  A held button keeps the :hover treatment.
*/

.kd-btn,
.kd-btn--ghost {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--btn-gap);
  height: var(--btn-height);
  padding: var(--btn-padding);
  border: var(--btn-border-width) solid var(--btn-ghost-border);
  border-radius: var(--btn-radius);
  background: var(--btn-ghost-fill);
  color: var(--btn-ghost-text);
  box-shadow: var(--btn-shadow);
  font-family: var(--btn-font);
  font-size: var(--btn-font-size);
  font-weight: var(--btn-font-weight);
  letter-spacing: var(--btn-letter-spacing);
  cursor: pointer;
}

.kd-btn:hover,
.kd-btn--ghost:hover {
  background: var(--btn-ghost-fill-hover);
  color: var(--btn-ghost-text-hover);
}

.kd-btn:active,
.kd-btn--ghost:active {
  background: var(--btn-ghost-fill-pressed);
  color: var(--btn-ghost-text-pressed);
}

.kd-btn--secondary {
  border: var(--btn-border-width-secondary) solid var(--btn-secondary-border);
  background: var(--btn-secondary-fill);
  color: var(--btn-secondary-text);
}

.kd-btn--secondary:hover {
  background: var(--btn-secondary-fill-hover);
  color: var(--btn-secondary-text-hover);
}

.kd-btn--secondary:active {
  background: var(--btn-secondary-fill-pressed);
  color: var(--btn-secondary-text-pressed);
}

.kd-btn--primary {
  border: var(--btn-border-width) solid var(--btn-primary-border);
  border-radius: var(--btn-radius-primary);
  padding: var(--btn-padding-primary);
  background: var(--btn-primary-fill);
  color: var(--btn-primary-text);
  font-weight: var(--btn-font-weight-primary);
}

.kd-btn--primary:hover {
  background: var(--btn-primary-fill-hover);
  color: var(--btn-primary-text-hover);
  filter: var(--btn-primary-hover-filter);
}

.kd-btn--primary:active {
  background: var(--btn-primary-fill-pressed);
  color: var(--btn-primary-text-pressed);
  filter: var(--btn-primary-pressed-filter);
}

.kd-btn--sm {
  height: var(--btn-height-sm);
}

.kd-btn:focus-visible,
.kd-icon-btn:focus-visible {
  outline: var(--btn-focus-width) solid var(--btn-focus-color);
  outline-offset: var(--btn-focus-offset);
}

.kd-btn:disabled,
.kd-icon-btn:disabled {
  opacity: var(--btn-disabled-opacity);
  cursor: default;
}

.kd-icon-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--btn-icon-size);
  height: var(--btn-icon-size);
  padding: 0;
  border: var(--btn-border-width) solid var(--btn-ghost-border);
  border-radius: var(--btn-radius);
  background: var(--btn-icon-fill);
  color: var(--btn-ghost-text);
  box-shadow: var(--btn-shadow);
  cursor: pointer;
}

.kd-icon-btn:hover,
.kd-icon-btn:active {
  background: var(--btn-icon-fill-hover);
}

.kd-icon-btn svg {
  width: var(--btn-icon-glyph);
  height: var(--btn-icon-glyph);
}
/*
  Satchel title bar. Rules from packages/desktop/src/renderer/styles/chrome.css
  (.titlebar, .title-drag, .title-menus, .title-menu-btn, .title-menu-pop,
  .title-mark, .window-controls, .keel-wordmark).
  The title-bar wordmark has class title-word and no size rule of its own, so it
  inherits the body size, 13.5px (--font-size). That is --titlebar-wordmark-size.
*/

.keel-wordmark {
  font-family: var(--wordmark-font);
  font-weight: 900;
  font-variation-settings: 'wght' 900;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--brand-mark, #1D4834);
  line-height: 1;
}

.titlebar .keel-wordmark,
.title-word {
  font-size: var(--titlebar-wordmark-size);
}

.titlebar {
  height: var(--titlebar-height);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  background: var(--bg-toolbar);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  user-select: none;
}
.titlebar.mac { padding-left: var(--titlebar-mac-inset); -webkit-app-region: drag; }
.title-drag { flex: 1; height: 100%; display: flex; align-items: center; -webkit-app-region: drag; }
.title-menus, .window-controls, .title-menu-btn, .title-menu-pop button { -webkit-app-region: no-drag; }
.titlebar.menu-open, .titlebar.menu-open .title-drag, .titlebar.menu-open .drag { -webkit-app-region: no-drag; }
.window-controls, .title-menus { position: relative; z-index: 100; }
.title-menus { display: flex; gap: 2px; }
.title-menu { position: relative; }
.title-menu-btn, .window-controls button {
  height: 28px;
  min-width: 28px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
}
.title-menu-btn.on, .title-menu-btn:hover, .window-controls button:hover { background: var(--bg-hover); }
.window-controls .close:hover { background: #a33; color: white; }
.title-menu-pop {
  position: absolute;
  top: 32px;
  left: 0;
  z-index: 20;
  min-width: 180px;
  padding: 6px;
  background: var(--bg-elevated, var(--bg-app));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}
.title-menu-pop button { display: flex; justify-content: space-between; gap: 16px; text-align: left; padding: 6px 8px; border: 0; background: transparent; color: var(--ink); border-radius: var(--radius-sm); }
.title-menu-pop button:disabled { color: var(--ink-faint); }
.title-menu-pop kbd { color: var(--ink-muted); font-family: var(--mono); font-size: 11px; }
.title-menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.titlebar.mac .title-drag { min-height: var(--titlebar-height); }
.title-mark {
  display: flex;
  align-items: center;
  padding: 0;
  line-height: 0;
  flex: none;
}
.titlebar .title-mark,
.titlebar .title-mark svg {
  width: var(--titlebar-mark-size);
  height: var(--titlebar-mark-size);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--tabbar-height);
  padding: 0 12px 0 4px;
  flex: none;
}
.brand .keel-wordmark { font-size: 16px; }

/*
  Top-bar tokens. The same values live in tokens.css so applyTheme matches.
*/
:root {
  --titlebar-height: 40px;
  --titlebar-mac-inset: 78px;
  /* macOS traffic-light position: Electron trafficLightPosition {x:12,y:12}
     and Tauri trafficLightPosition. Matches --titlebar-height (40px) and
     --titlebar-mac-inset (78px). Apps must pass these in native window
     config. CSS cannot apply them. */
  --titlebar-traffic-x: 12px;
  --titlebar-traffic-y: 12px;
  --titlebar-mark-size: 28px;
  --titlebar-wordmark-size: 13.5px;
  --tabbar-height: 32px;
  --tabbar-pad-x: 10px;
  --tabbar-gap: 4px;
  --tab-height: 26px;
  --tab-pad-x: 12px;
  --tab-gap: 8px;
  --tab-max-width: 240px;
  --tab-radius: 8px 8px 0 0;
  --toolbar-min-height: 68px;
  --toolbar-pad: 6px 8px 8px;
  --toolbar-gap: 2px;
  --wincontrol-width: 28px;
  --wincontrol-height: 28px;
  --wincontrol-icon-size: 12px;
}

.tabbar {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: var(--tabbar-gap);
  height: var(--tabbar-height);
  padding: 0 var(--tabbar-pad-x);
  background: var(--bg-tab);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.tabbar::-webkit-scrollbar { display: none; }

.tab {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: var(--tab-gap);
  max-width: var(--tab-max-width);
  height: var(--tab-height);
  padding: 0 var(--tab-pad-x);
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--tab-radius);
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  cursor: pointer;
}
.tab.active {
  background: var(--bg-tab-active);
  color: var(--ink);
  border-color: var(--line);
  position: relative;
  top: 1px;
}
.tab:hover { background: var(--bg-hover); }
.tab.active:hover { background: var(--bg-tab-active); }
.tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab .close {
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 4px;
  color: var(--ink-faint);
  display: none;
  border: none;
  background: transparent;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.tab:hover .close,
.tab:focus-within .close { display: inline-flex; }
.tab .close:hover { background: var(--bg-hover); color: var(--ink); }

.tab-add {
  box-sizing: border-box;
  width: 22px;
  height: 22px;
  flex: none;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font: inherit;
  cursor: pointer;
}
.tab-add:hover { background: var(--bg-hover); color: var(--ink); }

.keel-wincontrols {
  display: flex;
  align-items: center;
  height: var(--wincontrol-height);
}
.keel-wincontrol {
  box-sizing: border-box;
  width: var(--wincontrol-width);
  min-width: var(--wincontrol-width);
  height: var(--wincontrol-height);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}
.keel-wincontrol svg {
  width: var(--wincontrol-icon-size);
  height: var(--wincontrol-icon-size);
  display: block;
}
.keel-wincontrol:hover { background: var(--bg-hover); }
.keel-wincontrol--close:hover { background: #a33; color: white; }

.keel-toolbar {
  display: flex;
  align-items: flex-end;
  gap: var(--toolbar-gap);
  min-height: var(--toolbar-min-height);
  padding: var(--toolbar-pad);
  background: var(--bg-toolbar);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  position: relative;
}
