/* MyWall — shared styles (sign-in, dashboard, admin, dialogs, forms).
   Type: Bricolage Grotesque for headings, Atkinson Hyperlegible for text (designed for readability, good for young readers). */
@import url("fonts.css");

:root {
  --bg: #EEF1F6; --surface: #FFFFFF; --surface-2: #F6F8FB; --ink: #182033; --muted: #5A6478; --line: #D6DCE6;
  --accent: #2B47D6; --accent-ink: #FFFFFF; --accent-soft: #E3E8FC;
  --ok: #157A47; --ok-soft: #DDF3E6; --warn: #A15C00; --warn-soft: #FFF0D6; --bad: #B42318; --bad-soft: #FDE4E1;
  --shadow: 0 1px 2px rgba(24, 32, 51, .08), 0 8px 24px -12px rgba(24, 32, 51, .28);
  --radius: 14px;
  --f-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --f-body: "Atkinson Hyperlegible", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151C; --surface: #1B2029; --surface-2: #222833; --ink: #E7EBF3; --muted: #9BA4B6; --line: #333B49;
    --accent: #8095FF; --accent-ink: #0D1122; --accent-soft: #252C4A;
    --ok: #5DD39A; --ok-soft: #173A29; --warn: #F2B35B; --warn-soft: #3A2C14; --bad: #FF8F82; --bad-soft: #43201D;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 28px -12px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(26px, 3.6vw, 36px); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 20px; font-weight: 800; }
h3 { font-size: 16px; }
p { margin: 0; }
code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: .92em; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 700; font-size: 14px;
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.sm { padding: 5px 11px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }

input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px; width: 100%; min-width: 0; }
textarea { resize: vertical; min-height: 90px; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label, .field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.form label > input, .form label > select, .form label > textarea { font-weight: 400; color: var(--ink); font-size: 15px; }
.check { display: flex !important; flex-direction: row !important; align-items: flex-start; gap: 10px; font-weight: 400 !important; color: var(--ink) !important; font-size: 15px !important; cursor: pointer; }
.check input { margin-top: 4px; }
.check small { display: block; color: var(--muted); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }

.alert { padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.alert.error { background: var(--bad-soft); color: var(--bad); }
.alert.success { background: var(--ok-soft); color: var(--ok); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }

/* Sign-in & installer */
.auth-page { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left));
  background-image: radial-gradient(var(--line) 1.2px, transparent 1.3px); background-size: 22px 22px; }
.auth-card { width: min(420px, 100%); background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.auth-card.wide { width: min(760px, 100%); }
.auth-card h2 { margin-top: 8px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--f-display); font-weight: 800; font-size: 20px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; width: 10px; height: 10px; border-radius: 50%; background: #FFD43B; top: 6px; left: 10px; box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist li > span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.checklist li.ok > span { background: var(--ok-soft); color: var(--ok); }
.checklist li.bad > span { background: var(--bad-soft); color: var(--bad); }
.checklist li.warn > span { background: var(--warn-soft); color: var(--warn); }
.checklist small { display: block; color: var(--muted); }

/* App shell */
.topbar { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap;
  padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topnav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.topnav a { padding: 7px 12px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 700; font-size: 14px; }
.topnav a:hover, .topnav a.on { color: var(--ink); background: var(--surface-2); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 28px max(16px, env(safe-area-inset-right)) 60px max(16px, env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 22px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { color: var(--muted); max-width: 65ch; margin-top: 6px; }

/* Dashboard */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 6px 14px; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.tab[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.board-tile { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.board-tile .thumb { height: 96px; position: relative; display: block; text-decoration: none; }
.board-tile .thumb .ico { position: absolute; left: 14px; bottom: -18px; width: 44px; height: 44px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; font-size: 22px; }
.board-tile .thumb .badge { position: absolute; right: 10px; top: 10px; }
.board-tile .info { padding: 26px 14px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.board-tile .info a.t { color: var(--ink); text-decoration: none; font-family: var(--f-display); font-weight: 800; font-size: 17px; overflow-wrap: anywhere; }
.board-tile .info a.t:hover { color: var(--accent); }
.board-tile .stats { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.board-tile .acts { display: flex; gap: 4px; flex-wrap: wrap; padding: 8px 10px 12px; border-top: 1px solid var(--line); }
.board-tile.archived { opacity: .7; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.empty-state { background: var(--surface); border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 32px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tpl { text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px; cursor: pointer; font: inherit; color: var(--ink); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tpl:hover { border-color: var(--muted); }
.tpl[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tpl .n { font-weight: 700; display: flex; gap: 8px; align-items: center; }
.tpl .d { font-size: 13px; color: var(--muted); }
.tpl .l { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: flex; flex-direction: column; gap: 14px; }

/* Dialogs */
.modal-back { position: fixed; inset: 0; background: rgba(10, 13, 20, .5); z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.modal { width: min(560px, 100%); max-height: 100%; overflow: auto; background: var(--surface); color: var(--ink); border-radius: 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; font-family: var(--f-body); }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px 6px; position: sticky; top: 0; background: inherit; z-index: 2; }
.modal-body { padding: 10px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 20px 18px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: inherit; }
.x-btn { border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.x-btn:hover { background: var(--surface-2); color: var(--ink); }

.toast-zone { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100% - 32px); }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); color: #fff; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Board wallpapers (shared by the dashboard thumbnails and the boards themselves) */
.wp-dots    { background-color: #E3E8F0; background-image: radial-gradient(#C3CBD8 1.3px, transparent 1.4px); background-size: 22px 22px; }
.wp-paper   { background-color: #F7F5EF; background-image: linear-gradient(#E3DED1 1px, transparent 1px); background-size: 100% 28px; }
.wp-grid    { background-color: #F1F5FA; background-image: linear-gradient(#D5DFEC 1px, transparent 1px), linear-gradient(90deg, #D5DFEC 1px, transparent 1px); background-size: 26px 26px; }
.wp-sunrise { background: linear-gradient(135deg, #FFB86B 0%, #FF7E95 55%, #B57BFF 100%); }
.wp-mint    { background: linear-gradient(160deg, #C8F2DD 0%, #9EDFD0 100%); }
.wp-sky     { background: linear-gradient(180deg, #A9D4FF 0%, #E2F0FF 100%); }
.wp-sand    { background: linear-gradient(160deg, #F1DFC1 0%, #E4C79D 100%); }
.wp-slate   { background-color: #3C4656; background-image: radial-gradient(rgba(255,255,255,.08) 1.2px, transparent 1.3px); background-size: 20px 20px; }
.wp-night   { background-color: #121A33; background-image: radial-gradient(rgba(255,255,255,.35) 1px, transparent 1.2px), radial-gradient(rgba(255,255,255,.18) 1px, transparent 1.2px); background-size: 90px 90px, 37px 37px; background-position: 0 0, 15px 20px; }
.wp-berry   { background: linear-gradient(150deg, #6B3FA0 0%, #C2417B 100%); }
.wp-forest  { background: linear-gradient(160deg, #1F4D3A 0%, #2F7A57 100%); }
.wp-plain   { background: #DCE1E9; }
.wp-custom  { background-size: cover; background-position: center; background-color: #333; }
.wp-dark-text { color: #F2F4F8; }
.copy-row { display: flex; gap: 6px; align-items: center; }
.copy-row input { flex: 1; }

/* Microsoft sign-in button (light button with the four-square logo, as Microsoft's branding asks) */
.ms-btn { background: #FFFFFF; color: #2F2F2F; border: 1px solid #8C8C8C; border-radius: 10px; padding: 11px 16px; font-size: 15px; font-family: "Segoe UI", var(--f-body); font-weight: 600; gap: 12px; }
.ms-btn:hover { background: #F3F3F3; border-color: #5E5E5E; }
.or-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .grid3 { grid-template-columns: 1fr; } }
