/* Shared styles for apps.cvdhkn.com - palette and shell match the cvdhkn.com homepage. */

/* ---------- palette: light is the base, dark overrides tokens only ---------- */
:root {
  --bg:          #f7f7f5;
  --bg-elev:     #ffffff;
  --bg-sunken:   #efeeea;
  --line:        #dedcd6;
  --line-strong: #c9c6be;
  --ink:         #1a1a18;
  --ink-mid:     #56544e;
  --ink-dim:     #8a877f;
  --accent:      #1f6f5c;
  --accent-ink:  #ffffff;
  --accent-soft: #e4f0eb;
  --up:          #16855f;
  --down:        #b23a3a;
  --down-soft:   #f8e7e6;
  --wake:        #a86414;
  --wake-soft:   #f6ecdc;
  --radius:      10px;
  --shadow:      0 1px 2px rgb(0 0 0 / .04), 0 4px 14px rgb(0 0 0 / .04);
  --shadow-pop:  0 2px 6px rgb(0 0 0 / .06), 0 12px 32px rgb(0 0 0 / .12);
  color-scheme:  light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #121312;
    --bg-elev:     #1a1c1a;
    --bg-sunken:   #0d0e0d;
    --line:        #2a2d2a;
    --line-strong: #3c403c;
    --ink:         #eceeea;
    --ink-mid:     #a4a8a2;
    --ink-dim:     #6e726c;
    --accent:      #5fd3ae;
    --accent-ink:  #0b1a15;
    --accent-soft: #16241f;
    --up:          #4fce9f;
    --down:        #e8736f;
    --down-soft:   #2a1716;
    --wake:        #e0a44a;
    --wake-soft:   #2a2115;
    --shadow:      0 1px 2px rgb(0 0 0 / .3), 0 4px 16px rgb(0 0 0 / .25);
    --shadow-pop:  0 2px 8px rgb(0 0 0 / .4), 0 14px 36px rgb(0 0 0 / .45);
    color-scheme:  dark;
  }
}
:root[data-theme="dark"] {
  --bg:          #121312;
  --bg-elev:     #1a1c1a;
  --bg-sunken:   #0d0e0d;
  --line:        #2a2d2a;
  --line-strong: #3c403c;
  --ink:         #eceeea;
  --ink-mid:     #a4a8a2;
  --ink-dim:     #6e726c;
  --accent:      #5fd3ae;
  --accent-ink:  #0b1a15;
  --accent-soft: #16241f;
  --up:          #4fce9f;
  --down:        #e8736f;
  --down-soft:   #2a1716;
  --wake:        #e0a44a;
  --wake-soft:   #2a2115;
  --shadow:      0 1px 2px rgb(0 0 0 / .3), 0 4px 16px rgb(0 0 0 / .25);
  --shadow-pop:  0 2px 8px rgb(0 0 0 / .4), 0 14px 36px rgb(0 0 0 / .45);
  color-scheme:  dark;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  font-variant-ligatures: none;
}

/* ---------- shell ---------- */
.wrap {
  max-width: 940px;
  margin: 0 auto;
  padding: 40px 24px 56px;
}
@media (max-width: 560px) { .wrap { padding: 28px 16px 40px; } }

/* ---------- header ---------- */
header.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: 22px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
}
.brand h1 {
  font-size: 25px;
  font-weight: 600;
  letter-spacing: .06em;
}
.brand p {
  margin-top: 5px;
  font-size: 13.5px;
  color: var(--ink-mid);
}
.brand p a { border-bottom: 1px solid var(--line-strong); }
.brand p a:hover { color: var(--ink); }
.head-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  flex: none;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  color: var(--ink-mid);
  transition: border-color .15s, color .15s;
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-sun  { display: block; }
.icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun  { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}
:root[data-theme="dark"]  .icon-sun  { display: none; }
:root[data-theme="dark"]  .icon-moon { display: block; }
:root[data-theme="light"] .icon-sun  { display: block; }
:root[data-theme="light"] .icon-moon { display: none; }

/* ---------- sections + cards ---------- */
.sec-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 2px 12px;
}
.sec-head h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-mid);
}
.sec-head .sub { font-size: 12px; color: var(--ink-dim); }

.card {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn:hover { border-color: var(--ink-dim); }
.btn:disabled { opacity: .45; cursor: default; }
.btn svg { width: 15px; height: 15px; flex: none; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { border-color: var(--accent); filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-mid); }
.btn-ghost:hover { border-color: var(--line); color: var(--ink); }
.btn-danger:hover { border-color: var(--down); color: var(--down); }
.btn-warn { background: var(--wake); border-color: var(--wake); color: #fff; }
:root[data-theme="dark"] .btn-warn { color: #1a1508; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-warn { color: #1a1508; }
}
.btn:focus-visible, .icon-btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- form controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.hint { font-size: 12px; color: var(--ink-dim); }
.input, select.input, textarea.input {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 14.5px;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--ink-dim); }
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.input[aria-invalid="true"] {
  border-color: var(--down);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--down) 15%, transparent);
}
textarea.input { resize: vertical; min-height: 84px; line-height: 1.5; }
select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a877f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  cursor: pointer;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 32px);
  padding: 10px 12px 10px 16px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  font-size: 13.5px;
}
.toast a, .toast button {
  background: none;
  border: 0;
  padding: 4px 6px;
  font-size: 13px;
  font-weight: 600;
  color: inherit;
  opacity: .85;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.toast a:hover, .toast button:hover { opacity: 1; }
.toast[data-tone="error"] { background: var(--down); color: #fff; }

/* ---------- footer ---------- */
footer.bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-dim);
}
footer.bottom a { border-bottom: 1px solid var(--line-strong); color: var(--ink-mid); }
footer.bottom a:hover { color: var(--ink); }

/* ---------- customer avatars (uploaded icon, or coloured code tile) ---------- */
.avatar {
  --h: 160;
  --size: 40px;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--size);
  height: var(--size);
  border-radius: 24%;
  background: hsl(var(--h) 40% 90%);
  color: hsl(var(--h) 48% 27%);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", "Cascadia Mono", Consolas, monospace;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1;
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
}
/* Logos are usually drawn for a white background, so keep one in dark mode too. */
.avatar-img {
  object-fit: contain;
  padding: 6%;
  background: #fff;
  border: 1px solid var(--line);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .avatar:not(.avatar-img) { background: hsl(var(--h) 22% 21%); color: hsl(var(--h) 55% 80%); }
}
:root[data-theme="dark"] .avatar:not(.avatar-img) { background: hsl(var(--h) 22% 21%); color: hsl(var(--h) 55% 80%); }
