/* Shiftly web — palette and sizes taken from main.py (1 Kivy dp ≈ 1 CSS px) */
:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --accent: #141414;
  --muted: #8c8c85;
  --red: #e54747;
  --line: #e6e6e0;
  --chip: #e6e6e0;
  --today: #e0e0db;
  --reset-bg: #f7eded;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--accent);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

#app { position: fixed; inset: 0; overflow: hidden; max-width: 520px; margin: 0 auto; }

.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  padding: calc(20px + var(--safe-top)) 20px calc(20px + var(--safe-bottom));
  gap: 12px;
  background: var(--bg);
  will-change: transform;
}
.screen.pad24 { padding-left: 24px; padding-right: 24px; padding-top: calc(24px + var(--safe-top)); padding-bottom: calc(24px + var(--safe-bottom)); }
.screen.setup { padding: calc(32px + var(--safe-top)) 32px calc(32px + var(--safe-bottom)); gap: 10px; overflow-y: auto; }

/* slide transitions (same feel as Kivy SlideTransition) */
.anim { transition: transform .25s ease; }
.from-right { transform: translateX(100%); }
.from-left  { transform: translateX(-100%); }
.to-left    { transform: translateX(-100%); }
.to-right   { transform: translateX(100%); }

/* text helpers */
.lbl { font-size: 15px; line-height: 1.8; }
.lbl.s11 { font-size: 11px; } .lbl.s12 { font-size: 12px; } .lbl.s13 { font-size: 13px; }
.lbl.s14 { font-size: 14px; } .lbl.s15 { font-size: 15px; }
.lbl.s20 { font-size: 20px; } .lbl.s28 { font-size: 28px; } .lbl.s32 { font-size: 32px; }
.bold { font-weight: 700; }
.muted { color: var(--muted); }
.center { text-align: center; }
.right { text-align: right; }
.spacer { flex: none; }
.fill { flex: 1 1 auto; }

/* header row */
.hdr { display: flex; align-items: center; height: 44px; flex: none; }
.hdr .lbl { flex: 1; line-height: 44px; }

.icon-btn {
  width: 44px; height: 44px; flex: none;
  background: none; border: 0; padding: 0; color: var(--muted);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn svg { width: 24px; height: 24px; fill: currentColor; }
.icon-btn.dark { color: var(--accent); }
.icon-btn.red { color: var(--red); }

/* buttons */
.btn {
  flex: none; height: 48px; width: 100%;
  border: 0; border-radius: 12px; cursor: pointer;
  font: inherit; font-size: 14px;
  background: var(--accent); color: #fff;
}
.btn:active { opacity: .82; }
.btn.grey { background: var(--chip); color: var(--accent); }
.btn.reset { background: var(--reset-bg); color: var(--red); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: none; }

/* cards */
.card {
  background: var(--surface); border-radius: 16px; padding: 14px; flex: none;
}
.card.big { padding: 20px; min-height: 110px; display: flex; flex-direction: column; justify-content: center; }
.card.big .lbl { line-height: 1.5; }
.card.row { display: flex; align-items: center; }
.card.row .info { flex: 1; min-width: 0; }
.card.row .info .lbl { line-height: 1.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.row .pay { flex: none; width: 70px; text-align: right; font-size: 14px; font-weight: 700; }
.card.row.tall { min-height: 90px; gap: 8px; }
.card.row.short { height: 68px; }
.card.row .right-col { width: 70px; flex: none; display: flex; flex-direction: column; align-items: flex-end; }
.card.row .right-col .pay { width: auto; line-height: 1.6; }
.card.row .right-col .icon-btn { width: 36px; height: 36px; margin-right: -8px; }
.card.row .right-col .icon-btn svg { width: 20px; height: 20px; }

.list { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-bottom: 16px; -webkit-overflow-scrolling: touch; }
.list.gap10 { gap: 10px; padding-bottom: 24px; }
.list .empty { color: var(--muted); text-align: center; font-size: 15px; line-height: 1.8; }
.mid-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 15px; }

/* inputs */
.field {
  flex: none; height: 48px; width: 100%;
  border: 0; border-radius: 4px; background: var(--surface); color: var(--accent);
  font: inherit; font-size: 16px; padding: 12px; outline: none;
  -webkit-appearance: none; appearance: none;
}
.field::placeholder { color: var(--muted); opacity: 1; }
.picker-btn {
  flex: none; height: 48px; width: 100%; text-align: left;
  border: 0; border-radius: 8px; background: var(--surface); color: var(--accent);
  font: inherit; font-size: 15px; padding: 0 12px; cursor: pointer;
}

.logo { width: 100px; height: 100px; align-self: center; flex: none; border-radius: 22px; }

/* modal + popup */
.overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--surface); border-radius: 20px; width: 88%; max-width: 420px; }
.modal.popup { padding: 24px 24px 0; }
.modal.popup h3 { margin: 0 0 12px; font-size: 16px; text-align: center; line-height: 24px; }
.modal.popup p { margin: 0 0 12px; font-size: 13px; color: var(--muted); text-align: center; line-height: 1.5; }
.rule { height: 1px; background: var(--line); }
.modal-btns { display: flex; height: 48px; margin: 0 -24px; }
.modal-btns button { flex: 1; background: none; border: 0; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; }
.modal-btns button.ok { color: var(--accent); font-weight: 700; }
.modal-btns button.ok.danger { color: var(--red); }
.modal-btns .vrule { width: 1px; background: var(--line); }

/* date picker */
.modal.date { width: 92%; padding: 16px; }
.cal-nav { display: flex; align-items: center; height: 44px; }
.cal-nav button { width: 44px; height: 44px; background: none; border: 0; font: inherit; font-size: 18px; color: var(--accent); cursor: pointer; }
.cal-nav .month { flex: 1; text-align: center; font-size: 16px; font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-grid.head { height: 24px; align-items: center; margin-top: 6px; }
.cal-grid.head span { font-size: 11px; color: var(--muted); text-align: center; }
.cal-grid .day { height: 38px; border: 0; border-radius: 8px; background: none; font: inherit; font-size: 13px; color: var(--accent); cursor: pointer; }
.cal-grid .day.today { background: var(--today); }
.cal-grid .day.sel { background: var(--accent); color: #fff; }
.cal-cancel { display: block; width: 100%; height: 36px; margin-top: 10px; background: none; border: 0; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }

/* time picker */
.modal.time { width: 80%; padding: 20px 20px 0; max-width: 340px; }
.modal.time h3 { margin: 0 0 12px; font-size: 15px; text-align: center; line-height: 24px; }
.drum { display: flex; height: 160px; gap: 8px; margin-bottom: 12px; }
.drum .col { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.drum .col .cap { font-size: 11px; color: var(--muted); text-align: center; height: 20px; line-height: 20px; flex: none; }
.drum .colon { width: 16px; flex: none; align-self: center; text-align: center; font-size: 24px; font-weight: 700; }
.drum .scroll { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; -webkit-overflow-scrolling: touch; }
.drum .cell { flex: none; height: 40px; border: 0; border-radius: 8px; background: none; font: inherit; font-size: 16px; color: var(--accent); cursor: pointer; }
.drum .cell.sel { background: var(--accent); color: #fff; }
.modal.time .modal-btns { margin: 0 -20px; height: 44px; }

.version { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.8; flex: none; }
.section-gap { height: 10px; flex: none; }
.hidden-file { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* v1.1 */
.stack { display: flex; flex-direction: column; gap: 10px; flex: none; }
select.field {
  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 1l5 5 5-5' fill='none' stroke='%238c8c85' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; border-radius: 8px;
}
.seg { flex: none; display: flex; gap: 2px; padding: 3px; background: var(--chip); border-radius: 12px; }
.seg button { flex: 1; height: 34px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--accent); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.banner { flex: none; border-radius: 12px; padding: 10px 14px; font-size: 13px; background: var(--chip); color: var(--accent); }
.banner.today { background: var(--accent); color: #fff; font-weight: 700; }
.mini-row { flex: none; font-size: 12px; margin-top: -4px; line-height: 1.4; }
.link { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: 12px; text-decoration: underline; cursor: pointer; }
.toggle-row { flex: none; display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 12px; padding: 12px 14px; }
.toggle-row .tr-text { flex: 1; min-width: 0; }
.toggle-row .tr-title { font-size: 15px; }
.toggle-row .tr-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.switch { flex: none; width: 51px; height: 31px; border-radius: 16px; border: 0; background: #d0d0ca; position: relative; cursor: pointer; padding: 0; transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(20px); }
.break-row { flex: none; display: flex; flex-direction: column; gap: 8px; background: var(--surface); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.br-line { display: flex; align-items: center; gap: 8px; }
.mini { width: 64px; height: 40px; text-align: center; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--accent); font: inherit; font-size: 16px; outline: none; }
.tappable { cursor: pointer; }
.tappable:active { opacity: .85; }
.card.log ul { margin: 8px 0 0; padding-left: 20px; font-size: 14px; line-height: 1.5; }
.card.log li { margin: 0 0 6px; }
.toast { position: absolute; left: 50%; bottom: calc(30px + var(--safe-bottom)); transform: translateX(-50%); background: #141414; color: #fff; padding: 10px 16px; border-radius: 20px; font-size: 13px; z-index: 60; opacity: 0; transition: opacity .2s; white-space: nowrap; pointer-events: none; }
.toast.show { opacity: 1; }
.version { padding-top: 8px; cursor: default; user-select: none; -webkit-user-select: none; }
