/* Nomad Life styles. Palette inspired by app.aave.com */

:root {
  --bg: #F1F1F3;
  --surface: #FFFFFF;
  --surface-2: #F7F7F9;
  --map-land: #D5D8E1;
  --map-pin: #177B84;
  --map-pin-base: #A13A8C;
  --map-pin-text: #FFFFFF;
  --text: #303549;
  --muted: #62677B;
  --border: #EAEBEF;
  --input-bg: #FFFFFF;
  --input-border: #D2D4DC;
  --topbar: #2B2D3C;
  --topbar-text: #F1F1F3;
  --primary: #383D51;
  --primary-text: #FFFFFF;
  --accent-1: #B6509E;
  --accent-2: #2EBAC6;
  --gradient: linear-gradient(248.86deg, #B6509E 10.51%, #2EBAC6 93.41%);
  --success: #46BC4B;
  --success-bg: #ECF8ED;
  --warning: #8F5A00;
  --warning-bg: #FEF5E8;
  --error: #F25A5A;
  --error-bg: #FBEAEA;
  --info: #0062D2;
  --info-bg: #E5EFFB;
  /* Text colors that meet WCAG AA (4.5:1) on this theme's surfaces */
  --link: #A13A8C;
  --success-text: #2A7E2F;
  --error-text: #C23434;
  --danger: #C93030;
  --shadow: 0 2px 1px rgba(0, 0, 0, 0.05), 0 0 1px rgba(0, 0, 0, 0.25);
  --radius: 8px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #1B2030;
  --surface: #292E41;
  --surface-2: #2F3449;
  --map-land: #3C4260;
  --map-pin: #2EBAC6;
  --map-pin-base: #E58FD1;
  --map-pin-text: #1B2030;
  --text: #F1F1F3;
  --muted: #A5A8B6;
  --border: #383D51;
  --input-bg: #1B2030;
  --input-border: #444A62;
  --topbar: #1B2030;
  --topbar-text: #F1F1F3;
  --primary: #F1F1F3;
  --primary-text: #1B2030;
  --success-bg: rgba(70, 188, 75, 0.14);
  --warning-bg: rgba(242, 164, 58, 0.14);
  --warning: #F2A43A;
  --error-bg: rgba(242, 90, 90, 0.14);
  --info: #6DB7FF;
  --info-bg: rgba(109, 183, 255, 0.10);
  --link: #E58FD1;
  --success-text: #6BD26F;
  --error-text: #FF8A8A;
  --shadow: 0 0 0 1px var(--border);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1B2030;
    --surface: #292E41;
    --surface-2: #2F3449;
    --map-land: #3C4260;
    --map-pin: #2EBAC6;
    --map-pin-base: #E58FD1;
    --map-pin-text: #1B2030;
    --text: #F1F1F3;
    --muted: #A5A8B6;
    --border: #383D51;
    --input-bg: #1B2030;
    --input-border: #444A62;
    --topbar: #1B2030;
    --topbar-text: #F1F1F3;
    --primary: #F1F1F3;
    --primary-text: #1B2030;
    --success-bg: rgba(70, 188, 75, 0.14);
    --warning-bg: rgba(242, 164, 58, 0.14);
    --warning: #F2A43A;
    --error-bg: rgba(242, 90, 90, 0.14);
    --info: #6DB7FF;
    --info-bg: rgba(109, 183, 255, 0.10);
    --link: #E58FD1;
    --success-text: #6BD26F;
    --error-text: #FF8A8A;
    --shadow: 0 0 0 1px var(--border);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
/* Author rules like .field { display: flex } would otherwise override the hidden attribute. */
[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 30px; font-weight: 700; overflow-wrap: anywhere; }
h2 { font-size: 17px; font-weight: 600; }
p { margin: 0; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding-top: 28px; padding-bottom: 48px; }
.narrow { max-width: 760px; margin: 0 auto; }

/* Top bar */
.topbar { background: var(--topbar); color: var(--topbar-text); border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--topbar-text); font-family: "Outfit", "Inter", system-ui, sans-serif; font-weight: 700; font-size: 20px; letter-spacing: -0.01em; white-space: nowrap; flex: none; }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; flex: none; width: 25px; height: 30px; }
.brand-logo.lg { width: 47px; height: 56px; margin: 0 auto; }
.topnav { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topnav-email { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topnav form { margin: 0; }
.topbar .btn-ghost { color: var(--topbar-text); border-color: rgba(255, 255, 255, 0.2); }
.topbar .btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }
.topbar .muted { color: #A5A8B6; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent; color: var(--topbar-text); display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); }
.icon-moon { display: block; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-moon { display: none; }
  :root:not([data-theme="light"]) .icon-sun { display: block; }
}

/* Footer */
.footer { border-top: 1px solid var(--border); padding: 18px 0; font-size: 13px; }
.footer a { text-decoration: none; }
.footer a:hover { text-decoration: underline; text-underline-offset: 2px; }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Utility */
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.small { font-size: 13px; }
.card-intro { margin-bottom: 16px; }  /* space between a card's intro text and the form below it */
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.gap-sm { gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.eyebrow { text-transform: uppercase; font-size: 12px; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.back { display: inline-block; margin-bottom: 12px; font-size: 14px; color: var(--muted); }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px;
}
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .muted { margin-top: 6px; max-width: 560px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 6px; font: inherit; font-weight: 600; font-size: 14px;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background 0.15s, opacity 0.15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover { opacity: 0.88; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.88); }  /* darken, never fade: white text keeps its contrast */
.btn-danger-ghost { background: transparent; color: var(--error-text); border-color: transparent; }
.btn-danger-ghost:hover { background: var(--error-bg); }
/* On the tinted row of the current stay the two tints would add up and dim the red text. */
.table tr.current .btn-danger-ghost:hover { background: var(--surface); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; padding: 11px 16px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.grow { flex: 1; }
label { font-size: 13px; font-weight: 500; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--input-bg); border: 1px solid var(--input-border);
  border-radius: 6px; padding: 9px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--link); outline-offset: -1px; border-color: transparent; }
.input-sm { width: 120px; }
.hint { font-size: 12px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.check input { width: auto; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.file-input { display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 40px; }
.file-input > span[id] { min-width: 0; overflow-wrap: anywhere; }  /* long file names wrap */
.file-input input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-input:focus-within .btn { outline: 2px solid var(--link); }
.file-error { color: var(--error-text); }

/* Flash messages */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.flash { display: flex; align-items: flex-start; gap: 12px; overflow-wrap: anywhere; padding: 11px 14px; border-radius: 6px; font-size: 14px; border: 1px solid transparent; }
.flash-success { background: var(--success-bg); color: var(--success-text); border-color: rgba(70, 188, 75, 0.3); }
.flash-error { background: var(--error-bg); color: var(--error-text); border-color: rgba(242, 90, 90, 0.3); }
.flash-info, .flash-message { background: var(--info-bg); color: var(--info); border-color: rgba(0, 98, 210, 0.2); }
.flash-text { flex: 1; min-width: 0; }
.flash-close {
  flex: none; width: 24px; height: 24px; margin: -3px -6px -3px auto; display: grid; place-items: center;
  border: 0; border-radius: 4px; background: transparent; color: inherit; cursor: pointer; opacity: 0.8;
}
.flash-close:hover { opacity: 1; background: rgba(127, 127, 127, 0.16); }
.flash-close:focus-visible { opacity: 1; outline: 2px solid currentColor; outline-offset: 1px; }
.main:focus { outline: none; }

/* Auth */
.auth-wrap { display: grid; place-items: center; padding: 24px 0; }
.auth-card { width: 100%; max-width: 420px; padding: 28px; }
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-head h1 { font-size: 24px; margin-top: 14px; }
.auth-head p { margin-top: 6px; }

/* Year tabs */
.year-tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 4px; flex-wrap: wrap; }
.year-tab { padding: 5px 12px; border-radius: 5px; color: var(--muted); font-weight: 600; font-size: 14px; }
.year-tab:hover { text-decoration: none; background: var(--surface-2); color: var(--text); }
.year-tab.active { background: var(--primary); color: var(--primary-text); }
.year-tab.add { color: var(--link); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 4px; }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.stat-of { font-size: 15px; font-weight: 500; }
.stat-base { position: relative; overflow: hidden; }
.stat-base::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--gradient); }

.meter { position: relative; height: 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); overflow: visible; }
.meter span { display: block; height: 100%; border-radius: 4px; background: var(--gradient); }
.meter i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: 0.5; }
.meter-hot span { background: linear-gradient(90deg, #B6509E, #F25A5A); }

.pill { display: inline-block; align-self: flex-start; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill-ok { background: var(--success-bg); color: var(--success-text); }
.pill-warn { background: var(--warning-bg); color: var(--warning); }
.pill-error { background: var(--error-bg); color: var(--error-text); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); vertical-align: middle; }

.grid-main { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-top: 16px; }
.stats > .card, .grid-main > .card, .side > .card { margin-bottom: 0; min-width: 0; }
.empty-state { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }

.side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.main-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.main-col > .card { margin-bottom: 0; min-width: 0; }

/* Dashboard map: the land is world.svg used as a mask, so it takes the theme color. */
.map { position: relative; aspect-ratio: 1000 / 394.4; margin-top: 4px; }
/* The land zooms and pans inside a clipped viewport; pins stay outside it, at their size. */
.map-viewport { position: absolute; inset: 0; overflow: hidden; border-radius: 6px; }
.map.is-zoomed { cursor: grab; touch-action: none; }
.map.is-dragging { cursor: grabbing; user-select: none; }
.map-land {
  position: absolute; inset: 0; background: var(--map-land); transform-origin: 0 0;
  -webkit-mask: var(--map-image) center / 100% 100% no-repeat; mask: var(--map-image) center / 100% 100% no-repeat;
}
/* Pins carry the country's days: a round badge that widens for 3 digits, centered on the point. */
.map-pin {
  position: absolute; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px;
  transform: translate(-50%, -50%) translate(var(--nudge-x, 0px), var(--nudge-y, 0px));
  display: flex; align-items: center; justify-content: center;
  background: var(--map-pin); border: 2px solid var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); cursor: pointer;
  color: var(--map-pin-text); font: 700 11px/1 Inter, system-ui, sans-serif; font-variant-numeric: tabular-nums;
}
.map-pin-base { min-width: 26px; height: 26px; border-radius: 13px; font-size: 12px; background: var(--map-pin-base); }
.map-pin-days { pointer-events: none; }
.map-pin:hover, .map-pin:focus { z-index: 3; }
.map-pin:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.map-tip {
  position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%); z-index: 4;
  display: none; flex-direction: column; gap: 2px; min-width: 140px; max-width: 240px; padding: 8px 10px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); font-size: 13px; text-align: left; white-space: normal; pointer-events: none;
}
.map-tip::after {
  content: ""; position: absolute; left: 50%; top: 100%; margin-left: -6px;
  border: 6px solid transparent; border-top-color: var(--surface);
}
/* :focus too, so a tap on a phone (no hover, no focus-visible) also opens the tooltip. */
.map-pin:hover .map-tip, .map-pin:focus .map-tip { display: flex; }
.map-tip-country { font-weight: 700; overflow-wrap: anywhere; }
.map-tip-cities { color: var(--muted); overflow-wrap: anywhere; }
.map-tip-days { font-weight: 600; }
.tip-right .map-tip { left: -8px; transform: none; }
.tip-right .map-tip::after { left: 14px; }
.tip-left .map-tip { left: auto; right: -8px; transform: none; }
.tip-left .map-tip::after { left: auto; right: 8px; }
.tip-below .map-tip { bottom: auto; top: calc(100% + 10px); }
.tip-below .map-tip::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--surface); }
.map-pin.is-off { opacity: 0; pointer-events: none; }  /* outside the zoomed view */
.map-head-right { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px 14px; }
.map-zoom { display: flex; gap: 4px; }
.map-zoom[hidden] { display: none; }
.map-zoom-btn {
  width: 30px; height: 30px; display: grid; place-items: center; padding: 0; cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid var(--input-border); border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.map-zoom-btn:hover:not([aria-disabled="true"]) { background: var(--surface-2); }
.map-zoom-btn:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.map-zoom-btn[aria-disabled="true"] { color: var(--muted); opacity: 0.5; cursor: not-allowed; }
.map-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 12px; }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-credit { margin-left: auto; }
.map-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--map-pin); }
.map-dot-base { background: var(--map-pin-base); }
.storage-card { display: flex; flex-direction: column; gap: 8px; }
.storage-card .card-head { margin-bottom: 0; }
.upload .full { flex-basis: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.file-input:has(input:disabled) { cursor: not-allowed; }
.file-input:has(input:disabled) .btn { opacity: 0.5; pointer-events: none; }
.bars { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 14px; }
.bars .meter { margin-top: 6px; }
.bars .row > span:first-child, .stat p, .table td .small { min-width: 0; overflow-wrap: anywhere; }
/* The location column gets its share of the width, so place names only break when a single
   word is longer than the column, and "N counted" never splits. */
#movements .table td:nth-child(2) { width: 40%; }
.table td.num .small { overflow-wrap: normal; }
.plan-card .btn-block { white-space: normal; text-align: center; }

/* Table */
.table-wrap { overflow-x: auto; margin: 0 -20px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 8px 14px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table tr:last-child td { border-bottom: 0; }
.table tr.current td { background: var(--info-bg); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.loc-link { color: var(--text); overflow-wrap: anywhere; }

/* Pagination: square page numbers under the movements table */
#movements { scroll-margin-top: 16px; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--border); }
.pager { display: flex; flex-wrap: wrap; gap: 6px; }
.pager a, .pager span { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 6px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pager a { border: 1px solid var(--input-border); background: var(--surface); color: var(--text); }
.pager a:hover { text-decoration: none; background: var(--surface-2); }
.pager a[aria-current="page"] { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.pager a:focus-visible, .per-page a:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.pager-off { border: 1px solid var(--border); color: var(--muted); opacity: 0.6; }
.pager-gap { color: var(--muted); }
.per-page { display: flex; align-items: center; gap: 4px; }
.per-page a { min-width: 32px; padding: 3px 8px; border-radius: 5px; text-align: center; color: var(--muted); font-weight: 600; }
.per-page a:hover { text-decoration: none; background: var(--surface-2); color: var(--text); }
.per-page a[aria-current="true"] { background: var(--primary); color: var(--primary-text); }

.empty { color: var(--muted); padding: 18px 0; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }

/* Documents */
.doc-list { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; }
.doc { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.doc:last-child { border-bottom: 0; }
.doc form { margin: 0; }
.doc-icon { flex: none; width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; background: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)), var(--gradient); }
.doc-main { flex: 1; min-width: 0; }
.doc-main a { font-weight: 600; overflow-wrap: anywhere; }
.upload { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; padding-top: 16px; border-top: 1px dashed var(--border); }
.upload .field:first-of-type { width: 190px; }

.danger-zone { border-color: rgba(242, 90, 90, 0.35); }
.danger-zone h2 { color: var(--error-text); margin-bottom: 4px; }
.danger-zone form { margin-top: 10px; }
.danger-zone .row form { margin-top: 0; }

/* Flags: emoji flags drawn with the Twemoji country flag font (static/fonts, CC-BY 4.0), so they
   look the same on every OS, including Windows which has no emoji flags. unicode-range keeps the
   font to flag characters only and loads it only when a flag is on screen. */
@font-face {
  font-family: "Twemoji Country Flags";
  src: url("../fonts/TwemojiCountryFlags.woff2") format("woff2");
  unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067, U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F;
  font-display: swap;
}
.flag { font-family: "Twemoji Country Flags", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-style: normal; line-height: 1; }

/* Country combobox */
.combo { position: relative; }
.combo input { padding-left: 42px; }
.combo-flag { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 22px; text-align: center; font-size: 19px; pointer-events: none; }
.combo:not(.has-flag) .combo-flag::before { content: ""; display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px dashed var(--input-border); vertical-align: middle; }
.combo-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow-y: auto; margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18); }
.combo-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; color: var(--text); }
.combo-list li:hover { background: var(--surface-2); }
.combo-list li[aria-selected="true"] { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--link), inset 0 0 0 1px var(--input-border); }
.combo-list .flag { width: 22px; text-align: center; font-size: 18px; }
.combo-empty:empty { display: none; }
.combo-empty { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); padding: 10px 12px; font-size: 13px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }

/* Two step delete confirmation */
.confirm-dialog { width: min(440px, calc(100vw - 32px)); padding: 24px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3); }
.confirm-dialog::backdrop { background: rgba(15, 18, 30, 0.55); }
.confirm-dialog h2 { font-size: 20px; margin: 0 0 8px; }
.confirm-dialog h2, .confirm-dialog p, .confirm-dialog label { overflow-wrap: anywhere; }
.confirm-dialog .field { margin-top: 14px; }
.confirm-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

/* Accountant package */
.package-card { display: flex; flex-direction: column; gap: 12px; }
.package-card .card-head { margin-bottom: 0; }
.package-form { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.package-form .btn { white-space: normal; text-align: center; }

/* Row actions and document editing */
.row-actions { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
.row-actions form { margin: 0; }
.doc-edit { margin-top: 6px; }
.doc-edit summary { cursor: pointer; font-size: 13px; color: var(--link); width: fit-content; }
.doc-edit-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 10px; }
.doc-edit-form .field:not(.grow) { width: 170px; }

/* Landing page */
.btn-launch { background: #FFFFFF; color: #1B2030; }
.btn-launch:hover { opacity: 0.9; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 56px; align-items: center; padding: 36px 0 64px; }
.hero h1 { font-family: "Outfit", "Inter", system-ui, sans-serif; font-size: 52px; line-height: 1.08; letter-spacing: -0.02em; }
.hero-lead { font-size: 18px; color: var(--muted); margin: 18px 0 30px; max-width: 520px; }
.hero-preview { position: relative; isolation: isolate; padding: 0 0 28px 28px; }
.hero-preview::before { content: ""; position: absolute; inset: 12% 6% 18% 14%; background: var(--gradient); filter: blur(56px); opacity: 0.28; z-index: -1; }
/* The bottom padding leaves an empty strip for the floating receipt card to overlap. */
.preview-card { margin: 0; padding: 24px 24px 64px; }
.preview-card .bars { margin: 18px 0; }
.preview-card .pill { display: table; margin-left: auto; }  /* keep clear of the floating receipt card */
.preview-receipt { position: absolute; left: 0; bottom: 0; margin: 0; padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.feature { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.feature h3 { margin: 6px 0 0; font-size: 17px; }
.feature-icon { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; color: var(--link); background: var(--surface-2); border: 1px solid var(--border); }
.steps { margin: 64px 0 48px; }
.section-title { font-family: "Outfit", "Inter", system-ui, sans-serif; font-size: 30px; text-align: center; margin-bottom: 28px; }
.step-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.step-list li { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.step-list h3 { margin: 0; font-size: 15px; }
.hero h1 .eyebrow { display: block; margin-bottom: 10px; font-family: "Inter", system-ui, sans-serif; line-height: 1.5; letter-spacing: 0.08em; }
.step-num { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--primary); color: var(--primary-text); margin-bottom: 4px; }
.cta { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; padding: 28px 32px; margin: 0; }
.share { margin: 40px 0 8px; text-align: center; }
.share h2 { font-size: 16px; font-weight: 600; color: var(--muted); margin-bottom: 14px; }
.share-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.cta h2 { font-family: "Outfit", "Inter", system-ui, sans-serif; font-size: 24px; margin-bottom: 4px; }

/* Plans */
.plan-chip {
  flex: none; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  color: var(--topbar-text); border: 1px solid rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.08);
}
.plan-chip:hover { text-decoration: none; background: rgba(255, 255, 255, 0.16); }

/* User menu in the header: the email opens a panel with the plan, Admin and Sign out. */
.user-menu { position: relative; min-width: 0; }
.user-menu-trigger {
  display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 320px; padding: 6px 10px;
  border-radius: 8px; border: 1px solid transparent; color: #A5A8B6; font-size: 14px; cursor: pointer; list-style: none;
}
.user-menu-trigger::-webkit-details-marker { display: none; }
.user-menu-trigger:hover, .user-menu[open] .user-menu-trigger { color: var(--topbar-text); background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.2); }
.user-menu-trigger:focus-visible { outline: 2px solid var(--topbar-text); outline-offset: 2px; }
.user-menu-arrow { flex: none; transition: transform 0.15s; }
.user-menu[open] .user-menu-arrow { transform: rotate(180deg); }
.user-menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 200px; padding: 8px;
  display: flex; flex-direction: column; align-items: stretch; gap: 2px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.user-menu-panel form { margin: 0; }
.user-menu-panel .plan-chip {
  align-self: flex-start; margin: 4px 8px 8px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--link); border-color: var(--link); background: transparent;
}
.user-menu-panel .plan-chip:hover { background: var(--surface-2); }
.user-menu-item {
  display: flex; align-items: center; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.user-menu-item:hover, .user-menu-item:focus-visible { background: var(--surface-2); text-decoration: none; }
.user-menu-item:focus-visible { outline: 2px solid var(--link); outline-offset: -2px; }
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: stretch; margin-bottom: 16px; }
.plans-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.plan-card { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.plan-card > :last-child { margin-top: auto; }
.plan-name { font-size: 20px; margin: 0; }
.plan-price { font-size: 30px; font-weight: 700; margin: 0; }
.plan-price .muted { font-size: 15px; font-weight: 500; }
.plan-price .plan-year { font-size: 14px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.plan-price .plan-year strong { color: var(--text); font-weight: 700; }
.plan-saving { margin: -6px 0 0; }
.plan-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.plan-features li { padding-left: 22px; position: relative; overflow-wrap: anywhere; }
.plan-includes { margin: 0 0 -4px; font-size: 14px; font-weight: 700; }
.plan-features-plus li { font-weight: 600; }
.plan-features li::before { content: ""; position: absolute; left: 2px; top: 0.35em; width: 10px; height: 5px; border-left: 2px solid var(--success-text); border-bottom: 2px solid var(--success-text); transform: rotate(-45deg); }
.plan-features-plus li::before { border-color: var(--link); }
.plan-highlight { border-color: var(--link); box-shadow: 0 0 0 1px var(--link); }
.plan-current { border-color: var(--border); }
.pricing { margin: 0 0 48px; }
.pricing-lead { margin: -16px 0 24px; }

/* Responsive */
@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 36px; padding-bottom: 40px; }
  .hero h1 { font-size: 40px; }
  .hero-preview { max-width: 520px; }
  .plans { grid-template-columns: minmax(0, 1fr); max-width: 520px; margin-left: auto; margin-right: auto; }
}
@media (max-width: 600px) {
  h1 { font-size: 24px; }
  .stats { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .user-menu-trigger { max-width: calc(100vw - 210px); padding: 6px 8px; }
  .hero { padding-top: 12px; }
  .hero h1 { font-size: 32px; }
  .hero-lead { font-size: 16px; }
  .hero-preview { padding: 0; }
  .preview-card { padding: 24px; }
  .preview-receipt { position: static; margin-top: 12px; }
  .features, .step-list, .plans, .plans-2 { grid-template-columns: minmax(0, 1fr); }
  .steps { margin: 48px 0 36px; }
  .cta { padding: 22px; }
  .card { padding: 16px; }
  .table-wrap { margin: 0 -16px; }
  .table th, .table td { padding: 10px; }
  .table th:first-child, .table td:first-child { padding-left: 16px; }
  .table th:last-child, .table td:last-child { padding-right: 16px; }
  .table th:nth-child(3), .table td:nth-child(3) { padding-right: 16px; }  /* Days is the last visible column */
  .pager { gap: 4px; }
  .pager a, .pager span { width: 32px; height: 32px; }
  /* Smaller pins on phones, where neighbouring countries are only a few pixels apart. */
  .map-pin { min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; font-size: 10px; border-width: 1.5px; }
  .map-pin-base { min-width: 22px; height: 22px; border-radius: 11px; font-size: 11px; }
  .map-zoom-btn { width: 32px; height: 32px; }
  .doc { flex-wrap: wrap; }
  /* Icon and details on the first line, actions below, so the rename form gets the full width. */
  .doc-main { flex-basis: calc(100% - 52px); }
  .doc-edit-form .field:not(.grow) { width: 100%; }
  .upload .field:first-of-type { width: 100%; }
}
@media (max-width: 360px) {
  /* Keep "Nomad Life" on one line next to the header buttons on small phones. */
  .topbar-inner { gap: 8px; }
  .topnav { gap: 6px; }
  .brand { gap: 7px; font-size: 17px; }
  .icon-btn { width: 32px; height: 32px; }
  .btn-launch { padding: 6px 10px; font-size: 13px; }
}
@media (max-width: 330px) {
  /* The plan chip, Sign out and the theme button must still fit beside the name. */
  .topnav { gap: 4px; }
  .user-menu-trigger { max-width: calc(100vw - 190px); }
}
@media (max-width: 360px) {
  /* A slightly smaller table on the smallest phones keeps place names like "Amsterdam" whole. */
  #movements .table { font-size: 13px; }
  #movements .table .small { font-size: 12px; }
}
@media (max-width: 319px) {
  .brand { font-size: 15px; }
}

/* Admin page */
.admin-stats { margin-bottom: 20px; }
.admin-list { list-style: none; margin: 0; padding: 0; }
.admin-user { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 20px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.admin-user:last-child { border-bottom: 0; }
.admin-user-main { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.admin-email { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.admin-email .pill { margin: 0; }
.admin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.admin-actions form { margin: 0; }
.admin-quota { display: flex; align-items: center; gap: 6px; }
.admin-quota input { width: 110px; }
.admin-price input { width: 90px; }
.admin-plans { margin-bottom: 20px; }
.pending-email { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 16px; padding: 10px 14px; border-radius: 6px; background: var(--info-bg); overflow-wrap: anywhere; }
.pending-email form { margin: 0; }

/* Account page: two-factor setup and recent activity. The QR code keeps a white frame in dark
   mode too, so every authenticator app can read it. */
.tfa-setup { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 16px; }
.tfa-qr { display: block; width: 185px; height: 185px; border-radius: 6px; background: #FFFFFF; flex: none; }
.tfa-setup .stack { flex: 1 1 220px; min-width: 0; }
.tfa-key { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; overflow-wrap: anywhere; word-break: break-all; }
.activity-list { list-style: none; margin: 0 0 12px; padding: 0; }
.activity-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.activity-list li:last-child { border-bottom: 0; }
#activity .activity-list li > span { min-width: 0; overflow-wrap: anywhere; }
#activity form { margin-bottom: 8px; }

/* Settings page: jump links to each card, and the numbered two-factor setup steps. */
.settings-nav { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 0 0 16px; }
.settings-nav a { display: inline-block; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--link); font-size: 13px; font-weight: 500; }
.settings-nav a:hover { background: var(--surface-2); text-decoration: none; }
.settings-nav a:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.narrow > .card[id] { scroll-margin-top: 16px; }
.tfa-steps { flex: 1 1 220px; min-width: 0; margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.tfa-key { white-space: nowrap; word-break: normal; overflow-wrap: normal; }
.tfa-steps li:nth-child(2) .tfa-key { display: inline-block; white-space: normal; word-spacing: 2px; }
.admin-name { margin: 0 0 2px; font-weight: 600; overflow-wrap: anywhere; }
