/* UrDias — iOS clean theme (mobile-first) */

:root{
  --bg: #F6F8FB;
  --card: #FFFFFF;
  --text: #111827;
  --muted: #6B7280;
  --border: #E5E7EB;
  --primary: #2563EB;
  --primarySoft: rgba(37, 99, 235, .12);
  --danger: #EF4444;
  --dangerSoft: rgba(239, 68, 68, .10);
  --ok: #16A34A;
  --okSoft: rgba(22, 163, 74, .12);
  --shadow: 0 10px 25px rgba(17,24,39,.08);
  --shadowSm: 0 4px 12px rgba(17,24,39,.06);
  --radius: 16px;
  --radiusSm: 12px;
  --tap: 44px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.topbar{
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 64px 1fr 110px;
  align-items: center;
  padding: 12px 12px;
  background: rgba(246,248,251,.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(229,231,235,.85);
}

.topbar__title{
  text-align:center;
  font-weight: 800;
  letter-spacing: .2px;
  font-size: 16px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.topbar__left,.topbar__right{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}

.content{
  padding: 14px 14px 92px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}

/* Cards / Lists */
.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadowSm);
}

.card.clickable{ cursor:pointer; }
.card.clickable:active{ transform: scale(.99); }

.list{ display:flex; flex-direction:column; gap:10px; }

.row{ display:flex; gap:10px; align-items:center; }
.row.space{ justify-content:space-between; }

.title{
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 2px;
}

.muted{
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

/* Pills */
.pill{
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #F9FAFB;
  color: var(--muted);
  font-weight: 800;
}

.pill.ok{
  border-color: rgba(22,163,74,.28);
  background: var(--okSoft);
  color: #14532d;
}
.pill.draft{
  border-color: rgba(37,99,235,.28);
  background: var(--primarySoft);
  color: #1e3a8a;
}

/* Buttons */
.btn{
  min-height: var(--tap);
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--text);
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 750;
  cursor: pointer;
  user-select:none;
  box-shadow: 0 1px 0 rgba(17,24,39,.02);
}

.btn:active{ transform: scale(.99); }

.btn.ghost{
  background: transparent;
  box-shadow: none;
}

.btn.primary{
  border-color: rgba(37,99,235,.28);
  background: var(--primarySoft);
  color: #1e3a8a;
}

.btn.danger{
  border-color: rgba(239,68,68,.28);
  background: var(--dangerSoft);
  color: #991b1b;
  position: relative;
  overflow: hidden;
}

/* Inputs */
.input, .textarea, select.input{
  width:100%;
  min-height: var(--tap);
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #F9FAFB;
  color: var(--text);
  outline: none;
  font-size: 16px; /* critical for iOS zoom */
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.input::placeholder, .textarea::placeholder{ color: rgba(107,114,128,.75); }

.input:focus, .textarea:focus, select.input:focus{
  border-color: rgba(37,99,235,.45);
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
  background: #FFFFFF;
}

.textarea{
  resize: none;
  line-height: 1.35;
}

/* Field */
.field{ display:block; margin: 12px 0; }
.field .label{
  font-weight: 800;
  font-size: 13px;
  color: #374151;
  margin-bottom: 6px;
}
.field .hint{
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 6px;
}

/* Sections (details) */
details.section{
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  margin: 12px 0;
  overflow: hidden;
  box-shadow: var(--shadowSm);
}

details.section summary{
  list-style: none;
  cursor: pointer;
  padding: 12px 12px;
  font-weight: 900;
  font-size: 14px;
  color: #111827;
  border-bottom: 1px solid rgba(229,231,235,.85);
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}
details.section summary::-webkit-details-marker{ display:none; }
.section-body{ padding: 12px; }

/* Grid helpers */
.grid2{ display:grid; grid-template-columns: 1fr; gap: 10px; }
@media(min-width:560px){ .grid2{ grid-template-columns: 1fr 1fr; } }

.check{
  display:flex;
  gap:10px;
  align-items:center;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}
.check input{ transform: scale(1.1); }

.x{ opacity: .55; font-weight: 900; }

/* Footer bar */
.footerbar{
  position: fixed;
  left:0; right:0; bottom:0;
  z-index: 30;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(246,248,251,.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(229,231,235,.85);
  display:flex;
  gap:10px;
  justify-content:center;
}

.footerbar .btn{ max-width: 360px; width:100%; }

/* Modal */
.modal-backdrop{
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(17,24,39,.35);
  display:flex;
  align-items:flex-end;
  justify-content:center;
  padding: 14px;
}

.modal{
  width: min(760px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  max-height: 86vh;
  display:flex;
  flex-direction:column;
}

.modal-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: 12px;
  border-bottom: 1px solid rgba(229,231,235,.85);
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.modal-title{ font-weight: 900; }

.modal-body{ padding: 12px; overflow:auto; }
.modal-footer{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  padding: 12px;
  border-top: 1px solid rgba(229,231,235,.85);
  background: #FFFFFF;
}

/* Search bar */
.searchbar{ display:flex; gap:10px; align-items:center; margin: 8px 0 14px; }

/* Autosave banner */
.autosave{
  display:flex;
  gap: 10px;
  align-items:center;
  justify-content:space-between;
  padding: 10px 12px;
  border: 1px dashed rgba(229,231,235,.9);
  border-radius: var(--radius);
  margin-bottom: 12px;
  background: rgba(255,255,255,.7);
}
.dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(22,163,74,.9);
  box-shadow: 0 0 0 4px rgba(22,163,74,.12);
  flex: 0 0 auto;
}

/* Segmented */
.seg{ display:flex; gap:10px; }
.seg button{
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--text);
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(17,24,39,.02);
}
.seg button.on{
  border-color: rgba(37,99,235,.35);
  background: var(--primarySoft);
  color: #1e3a8a;
}

/* Chips / favorites */
.chips{ display:flex; flex-wrap:wrap; gap: 8px; margin-top: 10px; }
.chip{
  border: 1px solid rgba(229,231,235,.9);
  background: #F9FAFB;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 999px;
  cursor:pointer;
}
.chip:active{ transform: scale(.99); }
.star.on{ color: #f59e0b; }

/* Toast */
.toast{
  position: fixed;
  z-index: 80;
  left: 50%;
  transform: translateX(-50%);
  bottom: 90px;
  background: rgba(17,24,39,.86);
  color: #FFFFFF;
  border: 1px solid rgba(255,255,255,.12);
  padding: 10px 12px;
  border-radius: 999px;
  box-shadow: var(--shadowSm);
}

/* Hold-to-delete progress bar */
.holdbar{
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 7px;
  height: 3px;
  border-radius: 999px;
  background: rgba(239,68,68,.7);
  transform-origin: left center;
}

/* Filled highlight */
.input.filled, .textarea.filled, select.input.filled{
  border-color: rgba(22,163,74,.55) !important;
  box-shadow: 0 0 0 4px rgba(22,163,74,.12);
  background: #FFFFFF;
}
.card.filledcard{
  box-shadow: 0 0 0 3px rgba(22,163,74,.12), var(--shadowSm);
}
