/* go.mojtaba-alamer.com: "calm list". Grey ground, grouped white lists, one green action per screen.
   Self-contained plain CSS (no build step); colours follow the brand tokens of portfolio/site.css. */

:root {
  --ink: #000;
  --text: #2E3433;
  --muted: #66706F;
  --green: #00A09D;        /* actions and large marks */
  --green-deep: #00706D;   /* small green text (AA on white) */
  --tint: #E5F4F3;
  --ground: #F4F7F7;       /* page background */
  --well: #E8EEEE;         /* search field, pressed rows */
  --line: #E3EAEA;         /* hairlines inside groups */
  --paper: #fff;
  --danger: #B42318;

  --kufi: "Noto Kufi Arabic", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --plex: "IBM Plex Sans Arabic", system-ui, sans-serif;

  --r-group: 18px;
  --r-card: 22px;
  --gutter: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--ground); color: var(--text);
  font: 400 1rem/1.7 var(--plex);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; }
h1, h2 { margin: 0; color: var(--ink); }
p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: var(--green-deep); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--green-deep); outline-offset: 2px; border-radius: 6px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { flex: none; }
[dir="ltr"] { text-align: right; }   /* LTR text, but keep it on the Arabic side of the line */

h1 { font: 800 1.875rem/1.35 var(--kufi); }
.sub { color: var(--muted); margin-top: 2px; }
.quiet { color: var(--muted); }
.hint { color: var(--muted); font-size: .875rem; margin-top: 8px; }
.err { color: var(--danger); font-size: .875rem; font-weight: 500; margin-top: 8px; }

/* ── Shell: side menu (wide) / top bar (phone) ──────────────────────────── */
.shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 28px 18px; background: var(--paper); border-inline-end: 1px solid var(--line);
}
.side-logo img { height: 30px; width: auto; margin: 0 10px 32px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: var(--text); font-weight: 600; text-decoration: none;
}
.side-nav a .ic { color: var(--muted); }
.side-nav a:hover { background: var(--ground); }
.side-nav a[aria-current] { background: var(--tint); color: var(--green-deep); }
.side-nav a[aria-current] .ic { color: var(--green-deep); }
.side-foot { margin-top: auto; padding: 14px 12px 0; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-name { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot form { margin: 0; }
.side-out { background: none; border: 0; padding: 6px 0; color: var(--muted); cursor: pointer; }
.side-out:hover { color: var(--danger); }

.topbar { display: none; }
.page { width: 100%; max-width: 920px; padding: 40px 48px 96px; }

/* Account menu on phones */
.me { position: relative; }
.me summary { list-style: none; cursor: pointer; }
.me summary::-webkit-details-marker { display: none; }
.me-dot {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--tint); color: var(--green-deep); font-weight: 700;
}
.me-menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 30; min-width: 190px;
  background: var(--paper); border-radius: 16px; padding: 6px; box-shadow: 0 12px 40px rgba(10, 40, 40, .16);
}
.me-name { padding: 8px 12px 6px; font-size: .875rem; color: var(--muted); }
.me-menu a, .me-menu button {
  display: block; width: 100%; padding: 10px 12px; border-radius: 10px; border: 0; background: none;
  text-align: start; color: var(--ink); font-weight: 500; text-decoration: none; cursor: pointer;
}
.me-menu a:hover, .me-menu button:hover { background: var(--ground); }
.me-menu form { margin: 0; }
.me-menu button { color: var(--danger); }

/* ── Building blocks ────────────────────────────────────────────────────── */
.group { background: var(--paper); border-radius: var(--r-group); overflow: hidden; }
.group > li + li, .group > * + * { border-top: 1px solid var(--line); }
.group-title { font: 600 .9375rem/1.5 var(--plex); color: var(--muted); margin: 24px 6px 8px; }
.card { background: var(--paper); border-radius: var(--r-card); padding: 24px 20px; }

.row {
  display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 12px 16px;
  color: inherit; text-decoration: none;
}
a.row:hover { background: #FAFCFC; }
a.row:active { background: var(--well); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-main b { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-url { color: var(--green-deep); font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-note { color: var(--muted); font-size: .875rem; }
.row-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; font-size: .8125rem; color: var(--muted); }
.row-side b { font-size: 1.0625rem; color: var(--ink); font-weight: 700; }
.row--static { min-height: 56px; }

/* A link's initial: the "app icon" of each row */
.mono {
  flex: none; width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  font: 700 1.0625rem/1 var(--plex);
}
.mono--0 { background: var(--tint); color: var(--green-deep); }
.mono--1 { background: #FFF1E0; color: #8F5400; }
.mono--2 { background: #EEE9FB; color: #5B3FB0; }
.mono--3 { background: #E4EEFA; color: #1F5596; }

.state { display: inline-block; font-size: .8125rem; font-weight: 600; color: var(--muted); background: var(--ground); border-radius: 999px; padding: 2px 10px; }
.state--expired { color: #8A5A00; background: #FFF3DB; }
.state--live { color: var(--green-deep); background: var(--tint); }

.btn-go, .btn-plain, .btn-danger, .btn-new {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 52px; padding: 12px 24px; border-radius: 999px; border: 0; cursor: pointer;
  font: 700 1.0625rem/1 var(--plex); text-decoration: none;
}
.btn-go { width: 100%; background: var(--green); color: var(--ink); }
.btn-go:hover { background: #00B5B1; }
.btn-plain { width: 100%; background: var(--paper); color: var(--ink); }
.btn-plain:hover { background: var(--well); }
.btn-danger { width: 100%; background: var(--danger); color: #fff; }
.btn-danger:hover { background: #962015; }
.btn-new { min-height: 46px; padding: 10px 20px 10px 22px; background: var(--green); color: var(--ink); font-size: 1rem; }
.btn-new:hover { background: #00B5B1; }

.back {
  display: inline-flex; align-items: center; gap: 4px; margin: 0 -6px 16px; padding: 6px;
  color: var(--green-deep); font-weight: 600; text-decoration: none; border-radius: 10px;
}
.back .ic { width: 20px; height: 20px; }
.back:hover { background: var(--tint); }

.toasts { margin-bottom: 20px; display: grid; gap: 8px; }
.toast { padding: 12px 16px; border-radius: 14px; background: var(--ink); color: #fff; font-weight: 500; }
.toast--error { background: #FDECEC; color: #8A1C1C; }
.toast.is-leaving { opacity: 0; transform: translateY(-6px); transition: opacity .3s, transform .3s; }

.narrow { max-width: 560px; }
.narrow > h1 { margin-bottom: 4px; }
.narrow > .sub { margin-bottom: 20px; }
.narrow > h1 + form, .narrow > h1 + .shorten-form { margin-top: 20px; }

/* ── Home: list ─────────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 14px; }
.search {
  flex: 1 1 280px; display: flex; align-items: center; gap: 8px; padding: 0 14px; min-height: 44px;
  background: var(--well); border-radius: 12px; color: var(--muted);
}
.search .ic { width: 19px; height: 19px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; padding: 10px 0; font: inherit; color: var(--ink); }
.search input::placeholder { color: #7C8786; }
.search:focus-within { box-shadow: 0 0 0 2px var(--green); }
.seg { display: flex; gap: 6px; }
.seg a {
  padding: 7px 16px; border-radius: 999px; background: var(--paper); color: var(--text);
  font-size: .9375rem; font-weight: 600; text-decoration: none; box-shadow: inset 0 0 0 1px var(--line);
}
.seg a:hover { box-shadow: inset 0 0 0 1px var(--green); }
.seg a[aria-current] { background: var(--green-deep); color: #fff; box-shadow: none; }
.nothing { text-align: center; color: var(--muted); padding: 40px 0; }

.empty { text-align: center; max-width: 380px; margin: 40px auto 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-ic, .confirm-ic {
  display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px;
  background: var(--tint); color: var(--green-deep); margin-bottom: 6px;
}
.empty-ic .ic, .confirm-ic .ic { width: 30px; height: 30px; }
.empty h2 { font: 800 1.375rem/1.4 var(--kufi); }
.empty p { color: var(--muted); margin-bottom: 14px; }
.empty .btn-go { max-width: 260px; }

.fab { display: none; }

/* ── Create: the sheet and the form inside it ───────────────────────────── */
.sheet {
  width: min(520px, calc(100% - 32px)); max-height: calc(100% - 48px); padding: 20px 22px 24px;
  border: 0; border-radius: 26px; background: var(--paper); color: var(--text);
  box-shadow: 0 24px 80px rgba(10, 40, 40, .25); overflow: auto;
}
.sheet::backdrop { background: rgba(10, 30, 30, .4); }
.sheet[open] { animation: sheet-pop .2s ease-out; }
@keyframes sheet-pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.sheet-grab { display: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sheet-head h2 { font: 800 1.375rem/1.4 var(--kufi); }
.sheet-x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--ground); color: var(--muted); cursor: pointer; font-size: .9rem; }
.sheet-x:hover { background: var(--well); color: var(--ink); }
.sheet .opts { background: var(--ground); }

.shorten-form { display: flex; flex-direction: column; }
.url-label { font-weight: 600; color: var(--ink); margin-bottom: 8px; }
.url-box {
  display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 4px;
  background: var(--paper); border-radius: 16px; box-shadow: inset 0 0 0 1.5px var(--line);
}
.sheet .url-box { background: var(--ground); box-shadow: none; }
.url-box:focus-within { box-shadow: inset 0 0 0 2px var(--green); }
.url-box--error, .url-box--error:focus-within { box-shadow: inset 0 0 0 2px #E5484D; }
.shorten-input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none; padding: 12px;
  font: 500 1.0625rem/1.4 var(--plex); color: var(--ink); direction: ltr; text-align: left;
}
.shorten-input::placeholder { color: #8A9493; }
.paste {
  flex: none; border: 0; border-radius: 12px; padding: 9px 14px; cursor: pointer;
  background: var(--tint); color: var(--green-deep); font-weight: 600;
}
.paste:hover { background: #D3ECEA; }
.paste[hidden] { display: none; }
.shorten-form .opts { margin-top: 16px; }
.shorten-form .btn-go { margin-top: 18px; }

/* Option rows: label + current value; tap to change */
.opts { background: var(--paper); }
.opt summary {
  display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 10px 14px;
  list-style: none; cursor: pointer;
}
.opt summary::-webkit-details-marker { display: none; }
.opt summary:hover { background: rgba(0, 0, 0, .02); }
.opt-ic { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--tint); color: var(--green-deep); }
.opt-ic .ic { width: 18px; height: 18px; }
.opt-name { flex: 1; font-weight: 500; color: var(--ink); }
.opt-val { font-style: normal; color: var(--muted); font-size: .9375rem; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt summary > .ic { width: 18px; height: 18px; color: #A3ADAC; transition: transform .2s; }
.opt[open] summary > .ic { transform: rotate(-90deg); }
.opt-body { padding: 0 14px 16px 14px; padding-inline-start: 58px; }
.opt[open] .opt-body { animation: opt-in .18s ease-out; }
@keyframes opt-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.field {
  width: 100%; min-height: 46px; padding: 10px 14px; border: 0; border-radius: 12px;
  background: var(--ground); font: 400 1rem/1.5 var(--plex); color: var(--ink);
}
.sheet .field { background: var(--paper); }
.field:focus { outline: 0; box-shadow: inset 0 0 0 2px var(--green); }
.combo { display: flex; align-items: center; direction: ltr; border-radius: 12px; background: var(--ground); overflow: hidden; }
.sheet .combo { background: var(--paper); }
.combo:focus-within { box-shadow: inset 0 0 0 2px var(--green); }
.combo--error { box-shadow: inset 0 0 0 2px #E5484D; }
.combo-prefix { padding-left: 14px; color: var(--muted); white-space: nowrap; font-size: .9375rem; }
.combo .field { background: none; padding-left: 1px; min-width: 0; text-align: left; }
.combo .field:focus { box-shadow: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-block; padding: 7px 15px; border-radius: 999px; background: var(--ground);
  font-size: .9375rem; font-weight: 500; color: var(--text); transition: background .15s, color .15s;
}
.sheet .chip span { background: var(--paper); }
.chip:hover span { box-shadow: inset 0 0 0 1px var(--green); }
.chip input:checked + span { background: var(--green-deep); color: #fff; }
.chip input:focus-visible + span { outline: 3px solid var(--green-deep); outline-offset: 2px; }
.expiry-custom { margin-top: 10px; }
.no-js .chips { display: none; }
.js [data-expiry]:not(.is-custom) .expiry-custom { display: none; }

/* ── Link page ──────────────────────────────────────────────────────────── */
.detail { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
.detail-main { position: sticky; top: 24px; }
.hero { text-align: center; display: flex; flex-direction: column; align-items: center; }
.hero-title { font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.hero-qr { width: 200px; height: 200px; border-radius: 14px; image-rendering: pixelated; }
.hero-link { margin-top: 12px; font: 700 1.25rem/1.45 var(--plex); color: var(--ink); text-align: center; overflow-wrap: anywhere; }
.hero-dest { margin-top: 2px; max-width: 100%; color: var(--muted); font-size: .875rem; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero .state { margin-top: 12px; }

.acts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.act {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 4px 12px;
  border: 0; border-radius: 18px; background: var(--paper); color: var(--text); cursor: pointer;
  font-size: .8125rem; font-weight: 600; text-decoration: none;
}
.act:hover { background: #FAFCFC; }
.act:active { background: var(--well); }
.act-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: var(--tint); color: var(--green-deep); }
.act--main .act-ic { background: var(--green); color: var(--ink); }
.act.is-done .act-ic { background: var(--green-deep); color: #fff; }

.stats .nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stats .nums b { display: block; font: 800 1.625rem/1.3 var(--kufi); color: var(--ink); }
.stats .nums span { font-size: .8125rem; color: var(--muted); }
.spark { display: block; width: 100%; height: 72px; margin-top: 18px; direction: ltr; transform: scaleX(-1); }   /* RTL: today on the left */
.spark-area { fill: var(--tint); }
.spark-line { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.spark-axis { display: flex; justify-content: space-between; margin-top: 4px; font-size: .75rem; color: var(--muted); }
.stats .quiet { margin-top: 16px; }

/* ── Edit / password / login forms ──────────────────────────────────────── */
.form { display: flex; flex-direction: column; }
.form > .group + .group, .form > .hint + .group, .form > .err + .group, .form > .fields + .opts, .form > .opts + .group { margin-top: 16px; }
.form > .btn-go { margin-top: 22px; }
.fields .fld { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; cursor: text; }
.fld > span { font-size: .8125rem; font-weight: 600; color: var(--muted); }
.fld .field { background: none; padding: 4px 0; min-height: 34px; border-radius: 0; }
.fld .field:focus { box-shadow: none; }
.fld:focus-within > span { color: var(--green-deep); }
.form > .hint, .form > .err { padding-inline: 6px; }

.row--switch { cursor: pointer; }
.row--switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { flex: none; position: relative; width: 50px; height: 30px; border-radius: 999px; background: #D6DEDD; transition: background .15s; }
.switch::after {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); transition: inset-inline-start .15s;
}
.row--switch input:checked + .switch { background: var(--green); }
.row--switch input:checked + .switch::after { inset-inline-start: 23px; }
.row--switch input:focus-visible + .switch { outline: 3px solid var(--green-deep); outline-offset: 2px; }
.row--switch .row-main b { white-space: normal; }

.danger-zone { margin-top: 32px; }
.row--danger { color: var(--danger); gap: 10px; min-height: 54px; }
.row--danger b { font-weight: 600; }
a.row--danger:hover { background: #FFF6F5; }

.confirm { text-align: center; display: flex; flex-direction: column; align-items: center; padding: 32px 24px 24px; }
.confirm .confirm-ic { background: #FDECEC; color: var(--danger); }
.confirm h1 { font-size: 1.5rem; }
.confirm-link { margin: 4px 0 12px; font-weight: 700; color: var(--ink); text-align: center; overflow-wrap: anywhere; }
.confirm > p:not(.confirm-link) { color: var(--muted); max-width: 400px; }
.confirm-actions { width: 100%; display: grid; gap: 8px; margin-top: 24px; }
.confirm .btn-plain { background: var(--ground); }

/* Signed-out pages: one centred card */
.plain-main { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px var(--gutter) 48px; }
.plain-logo img, .plain-logo-img { height: 40px; width: auto; margin-bottom: 28px; }
.plain-main .toasts { width: 100%; max-width: 420px; }
.plain-card { width: 100%; max-width: 420px; }
.plain-card > h1 { text-align: center; }
.plain-card > .sub { text-align: center; margin-bottom: 22px; }
.plain-card > h1 + form { margin-top: 22px; }
.plain-card .toast { margin-bottom: 14px; }
.landing .group { margin-bottom: 22px; }
.landing .mono .ic { width: 22px; height: 22px; }
.gone { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0; }
.gone .sub { margin-top: 6px; }

/* ── Phones ─────────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .shell { display: block; }
  .side { display: none; }
  .topbar {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
    padding: 10px var(--gutter); padding-top: max(10px, env(safe-area-inset-top));
    background: rgba(244, 247, 247, .88); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  }
  .topbar img { height: 24px; width: auto; }
  .page { padding: 8px var(--gutter) calc(110px + env(safe-area-inset-bottom)); }
  h1 { font-size: 1.75rem; }

  .page-head { margin-bottom: 14px; }
  .btn-new { display: none; }
  .filters { gap: 10px; }
  .search { flex-basis: 100%; }
  .fab {
    position: fixed; z-index: 25; inset-inline-end: 20px; bottom: calc(24px + env(safe-area-inset-bottom));
    display: inline-flex; align-items: center; gap: 4px; height: 56px; padding: 0 22px 0 24px; border-radius: 999px;
    background: var(--green); color: var(--ink); font-weight: 700; font-size: 1.0625rem; text-decoration: none;
    box-shadow: 0 10px 24px rgba(0, 112, 109, .35);
  }
  .empty ~ .fab { display: none; }

  /* The create dialog becomes a bottom sheet */
  .sheet {
    width: 100%; max-width: none; max-height: 92vh; margin: auto 0 0; padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
    border-radius: 28px 28px 0 0;
  }
  .sheet[open] { animation: sheet-up .26s cubic-bezier(.2, .8, .2, 1); }
  @keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
  .sheet-grab { display: block; width: 44px; height: 5px; border-radius: 9px; background: #D6DEDD; margin: 0 auto 10px; }
  .sheet-head { margin-bottom: 12px; }

  .detail { display: block; }
  .detail-main { position: static; }
  .detail-side { margin-top: 14px; }
  .hero { padding-block: 22px 20px; }
  .hero-qr { width: 176px; height: 176px; }
  .opt-body { padding-inline-start: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet[open], .opt[open] .opt-body { animation: none; }
  .switch, .switch::after, .chip span, .opt summary > .ic, .toast.is-leaving { transition: none; }
}
