/* Sala Secreta — base styles following Apple Human Interface Guidelines (light appearance) */
:root {
  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --surface-2: #FBFBFD;
  --fill: #F2F2F7;
  --fill-2: #E8E8ED;
  --label: #1D1D1F;
  --label-2: #6E6E73;
  --label-3: #86868B;
  --separator: #E5E5EA;
  --accent: #C9915A;
  --accent-ink: #1D1D1F;
  --accent-text: #8A5A2B;
  --accent-soft: #F7F1EA;
  --red: #D70015;
  --red-soft: #FFECEB;
  --green: #1D7A4E;
  --green-soft: #E7F5EE;
  --blue: #0066CC;
  --blue-soft: #EAF3FF;
  --radius-s: 10px;
  --radius: 14px;
  --radius-l: 20px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 24px rgba(0,0,0,.06);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--label);
  font-family: var(--font); font-size: 15px; line-height: 1.47;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; letter-spacing: -0.015em; }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid rgba(201,145,90,.55); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 999px; border: 0; cursor: pointer;
  font-size: 15px; font-weight: 600; text-decoration: none !important; white-space: nowrap;
  transition: transform .12s ease, background-color .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #BE8550; }
.btn-dark { background: var(--label); color: #fff; }
.btn-dark:hover { background: #000; }
.btn-gray { background: var(--fill); color: var(--label); }
.btn-gray:hover { background: var(--fill-2); }
.btn-plain { background: transparent; color: var(--accent-text); padding: 0 10px; }
.btn-plain:hover { background: var(--accent-soft); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-lg { min-height: 52px; font-size: 17px; padding: 0 28px; }
.btn-sm { min-height: 34px; padding: 0 14px; font-size: 13px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; color: inherit;
}
.icon-btn:hover { background: rgba(127,127,127,.12); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 500; color: var(--label-2); }
.hint { font-size: 12px; color: var(--label-2); }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: var(--radius-s);
  border: 1px solid var(--separator); background: var(--surface); font-size: 15px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea.input { min-height: 96px; resize: vertical; line-height: 1.45; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(201,145,90,.18); }
select.input { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236E6E73' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--label-2); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }

/* Switch (iOS style) */
.switch { position: relative; display: inline-flex; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #E9E9EA; transition: background .2s ease; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); transition: transform .2s ease; }
.switch input:checked + span { background: #34C759; }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid rgba(201,145,90,.55); outline-offset: 2px; }

/* Segmented control */
.segmented { display: inline-flex; padding: 2px; border-radius: 10px; background: var(--fill-2); gap: 2px; flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; min-height: 32px; padding: 0 14px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--label); }
.segmented button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }

/* Cards & grouped lists */
.card { background: var(--surface); border-radius: var(--radius-l); box-shadow: 0 0 0 1px rgba(0,0,0,.04); }
.group { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: 0 0 0 1px rgba(0,0,0,.04); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 52px; }
.row + .row { border-top: 1px solid var(--separator); }
.row .grow { flex: 1 1 auto; min-width: 0; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--fill); color: var(--label-2); white-space: nowrap; }
.pill-live { background: var(--red-soft); color: var(--red); }
.pill-green { background: var(--green-soft); color: var(--green); }
.pill-accent { background: var(--accent-soft); color: var(--accent-text); }
.pill-blue { background: var(--blue-soft); color: var(--blue); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.dot-pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .dot-pulse { animation: none; } * { transition: none !important; } }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: rgba(29,29,31,.92); color: #fff;
  padding: 12px 18px; border-radius: 14px; font-size: 14px; z-index: 1000; box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); max-width: calc(100vw - 32px); }
.toast.error { background: rgba(215,0,21,.95); }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--fill-2); border-top-color: var(--label-2); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--label-2); }
.tabular { font-variant-numeric: tabular-nums; }
