/* ═══ APP THEME "brick" (blue) — brick look, chosen globally by the admin ═══
   Active once <html data-theme="brick"> is set (applyTheme() in js/theme-boot.js). All rules are scoped under
   [data-theme="brick"], so the file only takes effect with the active theme.
   A new theme: copy this file, replace the scope, add it to the theme choice and to DESIGNS on the server. */

[data-theme="brick"]{
  /* Muted slate-blue primary palette */
  /* Palette, chart colours and --brick-petrol are in /tokens.css, generated from shared/design-tokens.json so
     the Android app carries the same values. What only the web knows stays here. */
  --brick-petrol-dk:#316775;
  --brick-slate-lt:#8199b3;
  --bg:#c9d5e2;                 /* Page background behind the base plate */
  --screen-bg:#c9d5e2;          /* Login/startup screen (before login) */
  --rad:14px;
  /* The base plate (#e6ecf2) is darker than white; grey and profit text on it need darker tones to keep 4.5:1. */
  --mut:#52606f;
  --profit:#136c35;
  --sh0:0 1px 2px rgba(45,71,99,.10);
  --sh1:0 3px 10px rgba(45,71,99,.12);
  --sh2:0 8px 24px rgba(45,71,99,.16);
}

/* ── The stud row ──
   Studs are rectangles with a rounded top sitting ON the edge, not flat circles in it — the same mask as the
   noppe theme (--studs-shape in styles.css) in its own rhythm, so web and app show one shape. The row is an
   element of its own, only so can it lie above the edge. */

[data-theme="brick"] .sc::after,
[data-theme="brick"] .bstat::before,
[data-theme="brick"] .lcard::after{
  content:'';position:absolute;top:-6px;left:10px;right:10px;height:6px;z-index:4;
  background-color:var(--b400);
  -webkit-mask-image:var(--studs-form);mask-image:var(--studs-form);
  -webkit-mask-size:17px 6px;mask-size:17px 6px;
  -webkit-mask-repeat:repeat-x;mask-repeat:repeat-x;
}
/* On the light tile a lighter blue would not be visible. */
[data-theme="brick"] .bstat-light::before{background-color:#8fa8c0}
[data-theme="brick"] .bstat-petrol::before{background-color:#7fbccb}

/* ── Base plate: the whole app content sits in a light, rounded panel ── */
[data-theme="brick"] #app{
  max-width:1200px;margin:0 auto;background:#e6ecf2;
  border-radius:24px;padding:14px 16px 22px;
}
[data-theme="brick"] body{background:var(--bg)}

/* ── Header as a floating blue brick tile ── */
[data-theme="brick"] header{
  position:static;background:var(--b600);color:#fff;
  border-radius:16px;border-bottom:none;overflow:visible;
  padding:14px 20px;margin-bottom:14px;box-shadow:var(--sh1);
}
/* In dark mode --b600 is light (text on it dark); the header stays a dark blue so the white text stays readable. */
[data-theme="brick"][data-dark] header{background:var(--b200)}
[data-theme="brick"] header .logo .brand,
[data-theme="brick"] header .logo .brand span{color:#fff}
[data-theme="brick"] header .logo svg{
  background:#7fa3c9;border-radius:9px;padding:6px;box-sizing:content-box;
  filter:hue-rotate(200deg) saturate(.55) brightness(1.05);
}
[data-theme="brick"] header .ubadge{background:rgba(255,255,255,.16);color:#fff;border-color:rgba(255,255,255,.8)}
[data-theme="brick"] header #gib-text,
[data-theme="brick"] header #gib-chevron{color:rgba(255,255,255,.85)}

/* ── Navigation as chunky pills ── */
[data-theme="brick"] nav{
  position:static;background:transparent;border:none;box-shadow:none;
  padding:0;gap:9px;margin-bottom:16px;flex-wrap:wrap;
}
[data-theme="brick"] .ntab{
  background:#fff;color:#4a5763;border:1.5px solid #d4dde7;border-bottom:1.5px solid #d4dde7;
  border-radius:11px;padding:9px 16px;margin:0;font-weight:600;
}
@media (hover:hover){
[data-theme="brick"] .ntab:hover{background:#f2f6fa}
}
/* Dark: base plate and pills on the dark surfaces instead of fixed light ones. */
[data-theme="brick"][data-dark] #app,[data-theme="brick"][data-dark] .lcard{background:var(--s100)}
[data-theme="brick"][data-dark] .ntab{background:var(--sur);color:var(--txt);border-color:var(--bdr)}
[data-theme="brick"][data-dark] .cond-new{background:var(--b100);color:var(--b700)}
[data-theme="brick"][data-dark] .cond-used{background:var(--a100);color:var(--a-text)}
/* This theme is the only one that lets the tab bar WRAP (flex-wrap above); the others scroll it sideways.
   The narrow pills apply ALWAYS, without a media query: the tabs live in #app, capped at 1200px, so a query
   on the window width missed wide screens where the full pills (1162px) barely fit into 1168px. flex-wrap
   stays as the emergency exit below about 960px. */
[data-theme="brick"] nav{gap:6px}
[data-theme="brick"] .ntab{padding:8px 9px;font-size:.82rem}
[data-theme="brick"] .ntab.active{
  background:var(--b600);color:var(--on-primary,#fff);border-color:var(--b600);
}
[data-theme="brick"] .ntab.active svg{filter:brightness(0) invert(1)}
[data-theme="brick"] .ntab.group-active{
  background:var(--b600);color:var(--on-primary,#fff);border-color:var(--b600);
}
[data-theme="brick"] .ntab.group-active svg{filter:brightness(0) invert(1)}

/* ── Buttons: primary actions in petrol (brick look with "height") ── */
[data-theme="brick"] .btn{border-radius:10px}
/* Petrol stays the same in dark mode, so the text on it is fixed white instead of --on-primary, which is dark
   there for the lightened brand colour. */
[data-theme="brick"] .bp{
  background:var(--brick-petrol);box-shadow:0 2px 0 var(--brick-petrol-dk);color:#fff;
}
@media (hover:hover){
[data-theme="brick"] .bp:hover{background:#3a7080;box-shadow:0 1px 0 var(--brick-petrol-dk)}
}

/* ── Panels/cards a bit chunkier ────────────────────────────────────────── */
[data-theme="brick"] .card,[data-theme="brick"] .fstat,
[data-theme="brick"] .ssec{border-width:1.5px;border-radius:14px}

/* ── Set cards: blue stud "lid" above the image + badges ── */
/* ── Why the tile is open at the top ──
   The studs sit at top:-6px, ABOVE the tile like on a real brick, so the tile must not clip them (overflow:hidden
   from styles.css would). The image field keeps its own overflow:hidden; the coloured edge gets its own radius.
   The grid provides the room for the protruding studs. */
[data-theme="brick"] .sc{border-width:2px;border-radius:16px;overflow:visible}
[data-theme="brick"] .sgrid{padding-top:6px}
[data-theme="brick"] .bstat{overflow:visible}
[data-theme="brick"] .brick-stats{padding-top:6px}
/* The edge: the top surface of the brick. The studs (::after) sit in its first six pixels; the light seam
   on top and the dark edge below turn the surface into a body. */
[data-theme="brick"] .sc::before{
  content:'';position:absolute;top:0;left:0;right:0;height:22px;z-index:3;
  background-color:var(--b600);
  background-image:linear-gradient(180deg,
    rgba(255,255,255,.20) 0%,rgba(255,255,255,.05) 40%,rgba(0,0,0,.12) 100%);
  border-bottom:1px solid rgba(0,0,0,.18);
  /* Own radius, because the tile is open at the top and no longer clips: 16px tile minus 2px border. */
  border-radius:14px 14px 0 0;
}
[data-theme="brick"] .sc .sci{margin-top:22px}
/* Lift the delete button above the brick lid in the gallery (otherwise the lid covers it) */
[data-theme="brick"] .sc .ca{z-index:5}
/* The button sits on the dark-blue stud bar (--b600, 18px high): a light stroke on the lid instead of the
   light grey from styles.css — visible but calm. On hover it turns red as in the light theme. */
/* On the stud bar semi-transparent white looked washed out: full white for icon and border, the ground stays
   slightly translucent so the studs remain visible. On hover the ratio flips: white ground, icon in the bar colour. */
/* The same full white ground as on hover from the start: semi-transparent it was hardly visible. */
[data-theme="brick"] .sc .delbtn{
  background:#fff;border-color:#fff;color:var(--b600);
}
@media (hover:hover){
[data-theme="brick"] .sc .delbtn:hover{
  background:#fff;border-color:#fff;color:var(--r500);
}
}
[data-theme="brick"][data-dark] .sc .delbtn{background:var(--sur);border-color:var(--bdr)}@media (hover:hover){
[data-theme="brick"][data-dark] .sc .delbtn:hover{background:var(--sur);border-color:var(--bdr)}
}
[data-theme="brick"] .qbadge{background:var(--b600);color:var(--on-primary,#fff);border-radius:7px}
/* Condition badges: new = sage green, used = sand */
[data-theme="brick"] .cond-new{background:#e2eaf3;color:#3d6a8f}
[data-theme="brick"] .cond-used{background:#eee7db;color:#7a5c2a}

/* ── Key figure tiles: coloured in the brick theme ── */
[data-theme="brick"] .bstat{
  position:relative;border:0;border-radius:14px;padding:14px 16px;color:#fff;
}
[data-theme="brick"] .bstat .bstat-l{font-size:.82rem;color:inherit;text-transform:none;letter-spacing:0}
[data-theme="brick"] .bstat .bstat-v{font-size:1.7rem;font-weight:800;margin-top:2px;line-height:1.1;color:inherit}
[data-theme="brick"] .bstat .bstat-s{color:inherit}
[data-theme="brick"] .bstat-slate{background:var(--b600)}
/* Dark: the light brand surfaces glowed out of the room; there tinted dark tiles with a border, the studs carry the colour. */
[data-theme="brick"][data-dark] .bstat{background:var(--b100);color:var(--txt);border:1px solid var(--b300)}
[data-theme="brick"][data-dark] .bstat-petrol{background:#17313a;border-color:#2d5a66}
[data-theme="brick"][data-dark] .bstat-light{background:var(--s200);border-color:var(--s300)}
[data-theme="brick"][data-dark] .bstat::before{background-color:var(--b500)}
[data-theme="brick"][data-dark] .bstat-petrol::before{background-color:#5aa3b5}
[data-theme="brick"][data-dark] .bstat-light::before{background-color:var(--s400)}
[data-theme="brick"] .bstat-petrol{background:var(--brick-petrol)}
[data-theme="brick"] .bstat-light{background:var(--brick-slate-lt);color:#20303f}


/* ── Login and startup screens ──
   Both screens run BEFORE login (theme from js/theme-boot.js, background from --screen-bg). The card becomes a
   floating tile with a stud row — the same motif as .sc and .bstat after login, so logging in does not look
   like a theme change. */
[data-theme="brick"] #startup-screen,
[data-theme="brick"] #login-screen{
  background:var(--screen-bg);
  padding:20px;
}

[data-theme="brick"] .lcard{
  position:relative;
  background:#e6ecf2;
  border:none;
  border-radius:24px;
  padding:34px 30px 30px;
  box-shadow:var(--sh2);
  overflow:hidden;
}

/* Stud row at the top edge of the card */
[data-theme="brick"] .lcard::before{
  content:"";
  position:absolute;top:0;left:0;right:0;height:14px;
  background:var(--b600);
}


[data-theme="brick"] .llogo{margin-bottom:1.6rem}
[data-theme="brick"] .llogo .icon{background:var(--b600);border-radius:8px}
[data-theme="brick"] .llogo .llogo-name span{color:var(--b600)}

/* Inputs and buttons as in the app area */
[data-theme="brick"] .lcard input,
[data-theme="brick"] .lcard select{
  background:var(--sur);
  border:1px solid var(--field-border);
  border-radius:10px;
}
[data-theme="brick"] .lcard input:focus,
[data-theme="brick"] .lcard select:focus{
  border-color:var(--b400);
  outline:none;
}
[data-theme="brick"] .lcard .btn{border-radius:10px}
[data-theme="brick"] .lcard .bp{
  background:var(--b600);
  box-shadow:inset 0 -3px 0 rgba(0,0,0,.18);
}
@media (hover:hover){
[data-theme="brick"] .lcard .bp:hover{background:var(--b700)}
}
/* In dark mode --b600 is light: the text on it is then dark (--on-primary). */
[data-theme="brick"][data-dark] .lcard .bp{color:var(--on-primary)}
[data-theme="brick"] .lcard a{color:var(--b600)}

/* Startup screen: progress indicator in the theme's primary colour */
/* The progress bars need no own rule here: their styles use var(--b600)/var(--g500) and follow the theme. */
[data-theme="brick"] #startup-screen .spin{border-top-color:var(--b600)}

/* Focus ring on the blue header: white (the ring #2F4763 sat at 1.35:1). */
[data-theme="brick"]{--focus-header:#fff}
