/* Mənim Günüm — telefon versiyası. Rənglər kompüterdəki proqramın palitrasıdır (client/theme.py):
   işıqlı və qaranlıq rejim telefonun öz ayarına görə seçilir. */

:root {
  color-scheme: light dark;
  --bg: #f3f5f9; --surface: #ffffff; --surface2: #f7f9fc; --hover: #eef2f8;
  --border: #e1e6ee; --divider: #e9edf3; --text: #1a2435; --muted: #5f6b7e;
  --placeholder: #9aa4b4; --input-border: #8391a7;
  --accent: #1f3c72; --accent-pressed: #172f5b; --accent-text: #1f3c72;
  --accent-soft: #eaeff7; --accent-soft-border: #cbd6e8; --accent2: #4a7bd0;
  --side-top: #0e1a31; --side-bottom: #13254a; --gold: #d2a64b;
  --ok: #1d7a4e; --ok-soft: #e4f3eb; --warn: #99600f; --warn-soft: #fbf1df;
  --bad: #b42318; --bad-soft: #fbe7e5; --info: #5546b0; --info-soft: #eeecfa;
  --neutral: #64748b; --neutral-soft: #eef1f5;
  --login-top: #0c182e; --login-bottom: #1c3561;
  --shadow: 0 1px 2px rgba(16, 32, 64, .06), 0 4px 14px rgba(16, 32, 64, .05);
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1220; --surface: #121a2b; --surface2: #151f33; --hover: #1a2640;
    --border: #243149; --divider: #1e2a40; --text: #e3e8f1; --muted: #94a0b5;
    --placeholder: #5f6b82; --input-border: #5b6b88;
    --accent: #3a66b8; --accent-pressed: #30589f; --accent-text: #a9c1ec;
    --accent-soft: #172744; --accent-soft-border: #2a3f68; --accent2: #6f9be6;
    --side-top: #0a1121; --side-bottom: #0d1830;
    --ok: #4cc38a; --ok-soft: #112a20; --warn: #e2a54b; --warn-soft: #2d2311;
    --bad: #ef7067; --bad-soft: #341618; --info: #a597f0; --info-soft: #211c40;
    --neutral: #94a3b8; --neutral-soft: #1a2334;
    --login-top: #070d19; --login-bottom: #132a50;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; line-height: 1.4; -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.locked { overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.noscript { padding: 24px; text-align: center; }

.ic {
  width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---------------------------------------------------------------- açılış */
.boot {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(160deg, var(--login-top), var(--login-bottom));
}
.boot-logo { width: 72px; height: 72px; border-radius: 18px; animation: pulse 1.4s ease-in-out infinite; }
/* Açılış və giriş ekranları tünddür, sticky başlıqları yoxdur — iOS 26 status zolağını body-nin rəngi ilə boyayır */
body:has(.boot), body:has(.login) { background-color: var(--login-top); }
@keyframes pulse { 50% { opacity: .55; } }

/* ------------------------------------------------------------------ giriş */
.login {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center;
  padding: calc(24px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
  background: linear-gradient(160deg, var(--login-top), var(--login-bottom));
}
.login-card {
  width: 100%; max-width: 420px; margin: 0 auto; background: var(--surface);
  border-radius: 20px; padding: 24px 18px 20px; box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}
.login-logo { display: block; width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 12px; }
.login h1 { margin: 0; font-size: 23px; font-weight: 600; text-align: center; }
.login-company { margin: 4px 0 18px; color: var(--muted); font-size: 14px; text-align: center; }
.login-foot { margin-top: 16px; color: rgba(255, 255, 255, .62); font-size: 12.5px; text-align: center; }
.login-foot b { color: rgba(255, 255, 255, .85); font-weight: 600; }
.install-tip {
  width: 100%; max-width: 420px; margin: 0 auto 14px; padding: 12px 14px; border-radius: 14px;
  background: rgba(255, 255, 255, .1); color: #fff; font-size: 14px; display: flex; gap: 10px;
}
.install-tip .ic { color: var(--gold); margin-top: 1px; }

/* ---------------------------------------------------------- əsas çərçivə */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--safe-top)) 16px 12px;
  /* Gradientin altındakı sabit rəng vacibdir: iOS 26 status zolağının rəngini kənardakı fixed/sticky elementin
     background-color-undan götürür, gradienti görmür. Bu rəng olmasa body-nin açıq fonunu götürür —
     saat qara yazılır və başlığın üstünə ağ duman düşür ("Mənim Günüm" yazısı oxunmur). */
  background: var(--side-top) linear-gradient(135deg, var(--side-top), var(--side-bottom)); color: #fff;
}
.topbar-text { flex: 1; min-width: 0; }
.topbar-title { font-size: 19px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub { font-size: 13px; color: rgba(255, 255, 255, .68); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-btn {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 0; border-radius: 12px;
  background: rgba(255, 255, 255, .1); color: #fff;
}
.top-btn:active { background: rgba(255, 255, 255, .2); }
.top-btn.spin .ic { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.avatar {
  width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold); color: #1a1406; font-size: 14px; font-weight: 700; letter-spacing: .3px;
}
.content { max-width: 640px; margin: 0 auto; padding: 14px 16px calc(88px + var(--safe-bottom)); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex;
  background: var(--surface); border-top: 1px solid var(--border); padding-bottom: var(--safe-bottom);
}
.tab {
  flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 56px; padding: 8px 0 6px; border: 0; background: none; color: var(--muted); font-size: 11.5px;
}
.tab .ic { width: 23px; height: 23px; }
.tab.active { color: var(--accent-text); font-weight: 600; }
.tab.active .ic { stroke-width: 2.2; }
.tab-count {
  position: absolute; top: 4px; left: calc(50% + 7px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--accent2); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}

/* ------------------------------------------------------- kart və mətnlər */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.card.flush { padding: 0; overflow: hidden; }
.section-title {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin: 20px 2px 8px; font-size: 16px; font-weight: 600;
}
.section-title small { color: var(--muted); font-size: 13.5px; font-weight: 400; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.empty { padding: 26px 12px; color: var(--muted); text-align: center; }
.loading { padding: 40px 12px; color: var(--muted); text-align: center; }
.pre { white-space: pre-wrap; word-break: break-word; }

/* ---------------------------------------------------------------- statlar */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stats.three { grid-template-columns: 1fr 1fr 1fr; }
.stat {
  min-width: 0; padding: 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.stat.wide { grid-column: 1 / -1; }
.stat-head { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.stat-head .ic { width: 17px; height: 17px; }
.stat-head span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-value { margin-top: 4px; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-sub { margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.35; }
.stat-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stats.three .stat { padding: 10px; }
.stats.three .stat-value { font-size: 20px; }
.stats.three .stat-head { font-size: 12px; }

.tone-ok { color: var(--ok); } .tone-warn { color: var(--warn); } .tone-bad { color: var(--bad); }
.tone-info { color: var(--info); } .tone-accent { color: var(--accent-text); } .tone-muted { color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 3px 9px; border-radius: 999px;
  background: var(--neutral-soft); color: var(--neutral); font-size: 12.5px; font-weight: 600; line-height: 1.35;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }

/* --------------------------------------------------------------- zolaqlar */
.banner {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; padding: 12px 14px;
  border-radius: 14px; font-size: 14.5px; line-height: 1.45;
  background: var(--accent-soft); color: var(--accent-text);
}
.banner .ic { margin-top: 1px; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner.info { background: var(--info-soft); color: var(--info); }
.banner-body { flex: 1; min-width: 0; }
.banner-body .btn { margin-top: 10px; }
.login-card .banner { margin-bottom: 14px; }

/* --------------------------------------------------------------- düymələr */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px;
  padding: 0 16px; border: 1px solid transparent; border-radius: 12px; background: var(--surface2);
  color: var(--text); font-size: 15.5px; font-weight: 600; text-decoration: none; user-select: none;
}
.btn .ic { width: 19px; height: 19px; }
.btn:disabled { opacity: .55; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:active { background: var(--accent-pressed); }
.btn-secondary { background: var(--surface); border-color: var(--border); }
.btn-secondary:active, .btn-ghost:active { background: var(--hover); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-ghost { background: transparent; color: var(--accent-text); }
.btn-ghost.danger { color: var(--bad); }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 0 12px; border-radius: 10px; font-size: 14.5px; }
.btn-sm .ic { width: 17px; height: 17px; }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1; }
.fab {
  position: fixed; right: 16px; bottom: calc(72px + var(--safe-bottom)); z-index: 15;
  display: inline-flex; align-items: center; gap: 8px; min-height: 54px; padding: 0 22px 0 18px;
  border: 0; border-radius: 27px; background: var(--accent); color: #fff; font-size: 16.5px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(10, 24, 56, .38);
}
.fab .ic { width: 22px; height: 22px; stroke-width: 2.3; }
.fab:active { background: var(--accent-pressed); }
.content:has(.fab) { padding-bottom: calc(150px + var(--safe-bottom)); }
body:has(.fab) .toast { bottom: calc(140px + var(--safe-bottom)); }

/* ----------------------------------------------------------- forma sahələri */
.field { margin-bottom: 14px; }
.label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.input {
  display: block; width: 100%; min-height: 48px; padding: 11px 12px; border: 1.5px solid var(--input-border);
  border-radius: 12px; background: var(--surface); font-size: 16px; line-height: 1.35; outline: none;
  -webkit-appearance: none; appearance: none;
}
textarea.input { min-height: 92px; resize: vertical; }
.input::placeholder { color: var(--placeholder); }
.input:focus { border-color: var(--accent2); box-shadow: 0 0 0 3px var(--accent-soft-border); }
.input.invalid { border-color: var(--bad); background: var(--bad-soft); box-shadow: 0 0 0 3px var(--bad-soft); }
.input:disabled { opacity: .6; }
.field-error { margin-top: 6px; color: var(--bad); font-size: 13.5px; font-weight: 600; }
.field-hint { margin: 6px 0 0; }
input[type="date"].input, input[type="time"].input { font-variant-numeric: tabular-nums; }
.input::-webkit-date-and-time-value { text-align: left; min-height: 1.35em; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2 .field { min-width: 0; }

.seg {
  display: flex; gap: 3px; padding: 3px; border: 1px solid var(--border); border-radius: 13px;
  background: var(--surface2);
}
.seg button {
  flex: 1; min-height: 42px; padding: 0 6px; border: 0; border-radius: 10px; background: transparent;
  color: var(--muted); font-size: 14.5px; font-weight: 600;
}
.seg button[aria-checked="true"] { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.seg.disabled { opacity: .55; pointer-events: none; }

.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 52px; }
.pw-eye {
  position: absolute; top: 4px; right: 4px; width: 44px; height: 40px; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted); display: grid; place-items: center;
}

/* ----------------------------------------------------------- alt pəncərə */
.sheet-wrap {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(6, 12, 26, .5); animation: fade .15s ease-out;
}
.sheet {
  width: 100%; max-width: 640px; max-height: 94vh; max-height: 94dvh; overflow-y: auto;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 0 16px calc(18px + var(--safe-bottom)); border-radius: 20px 20px 0 0; background: var(--bg);
  animation: up .22s ease-out;
}
.sheet.full { height: 94vh; height: 94dvh; }
.sheet-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px;
  margin: 0 -16px 6px; padding: 14px 16px 10px; background: var(--bg);
}
.sheet-head h2 { flex: 1; margin: 0; font-size: 19px; font-weight: 600; }
.sheet-close {
  width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--hover); color: var(--muted);
  display: grid; place-items: center;
}
.sheet-sub { margin: -2px 0 14px; color: var(--muted); font-size: 14px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet-actions .btn { flex: 1; }
.sheet .note-box {
  margin-bottom: 14px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft);
  color: var(--accent-text); font-size: 14px; font-weight: 600; line-height: 1.45;
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }

/* --------------------------------------------------------------- işlər */
.task { position: relative; }
.task-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.task-time { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.task-dur { color: var(--muted); font-size: 14px; white-space: nowrap; }
.task-descr { margin: 6px 0 8px; white-space: pre-wrap; word-break: break-word; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.task-note { margin-top: 8px; color: var(--muted); font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.task-note b { color: var(--text); font-weight: 600; }
.task-actions {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 12px -14px -14px; padding: 10px 14px;
  border-top: 1px solid var(--divider); background: var(--surface2); border-radius: 0 0 var(--radius) var(--radius);
}
.task-actions .btn { flex: 1; }
.task.open { border-left: 4px solid var(--warn); }

/* --------------------------------------------------- tarix / ay seçimi */
.datenav { display: flex; align-items: stretch; gap: 8px; margin-bottom: 12px; }
.nav-btn {
  width: 46px; flex: none; display: grid; place-items: center; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.nav-btn:disabled { opacity: .35; }
.nav-mid {
  position: relative; flex: 1; min-width: 0; min-height: 52px; display: flex; flex-direction: column;
  justify-content: center; padding: 4px 8px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); text-align: center; box-shadow: var(--shadow);
}
.nav-big { font-size: 16px; font-weight: 600; }
.nav-small { color: var(--muted); font-size: 12.5px; }
.nav-mid input {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; -webkit-appearance: none;
}
.today-btn { margin: -4px 0 12px; }

/* ---------------------------------------------------- davamiyyət günləri */
.dayrow { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--divider); }
.dayrow:last-child { border-bottom: 0; }
.dayrow:active { background: var(--hover); }
.dayrow.dim { opacity: .62; }
.d-date { width: 50px; flex: none; text-align: center; }
.d-num { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.d-wd { color: var(--muted); font-size: 12.5px; }
.d-body { flex: 1; min-width: 0; }
.d-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 14px; margin-top: 4px; }
.d-line .k { color: var(--muted); }
.d-note { margin-top: 4px; color: var(--muted); font-size: 13.5px; word-break: break-word; }

/* -------------------------------------------------------- sorğu / şikayət */
.item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.item-title { font-weight: 600; }
.item-meta { margin-top: 2px; color: var(--muted); font-size: 13.5px; }
.item-text { margin-top: 8px; white-space: pre-wrap; word-break: break-word; }

/* ---------------------------------------------------------------- profil */
.profile { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.profile .avatar { width: 54px; height: 54px; font-size: 18px; }
.profile-name { font-size: 18px; font-weight: 600; }
.menu { margin-bottom: 12px; }
.menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 0 14px;
  border: 0; border-bottom: 1px solid var(--divider); background: var(--surface); font-size: 16px; text-align: left;
}
.menu button:last-child { border-bottom: 0; }
.menu button:active { background: var(--hover); }
.menu .danger { color: var(--bad); }
.about { color: var(--muted); font-size: 13px; text-align: center; line-height: 1.5; }

/* -------------------------------------------------------------- bildiriş */
.toast {
  position: fixed; left: 50%; bottom: calc(76px + var(--safe-bottom)); z-index: 90; width: max-content;
  max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 14px; background: #16213a; color: #fff;
  font-size: 14.5px; line-height: 1.4; box-shadow: 0 8px 28px rgba(0, 0, 0, .3);
  transform: translate(-50%, 10px); opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.warn { background: #7a4b0c; }
.toast.bad { background: #8f1c13; }
.no-tabbar .toast { bottom: calc(24px + var(--safe-bottom)); }

@media (min-width: 560px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stat.wide { grid-column: span 3; }
}
