/* dos-magazzino — UI v1
   Editorial-clean (DOS Design) with a restrained neo-brutalist touch:
   crisp borders, soft offset shadows, gentle hover lift, non-invasive motion.
   Mirrors dos-buonipasto's registry with the magazzino accent. */

:root {
  --bg: #f2f2f5;
  --surface: #ffffff;
  --ink: #141416;
  --ink-soft: #4a4a52;
  --ink-muted: #8b8b95;
  --line: #e7e7ee;
  --line-strong: #d7d7e0;

  --accent: #0a66ff;          /* magazzino blue */
  --accent-ink: #0047b3;
  --accent-soft: #e8f0ff;

  --dark: #141416;            /* primary button */
  --ok: #1f8a4c;
  --ok-soft: #e9f6ee;
  --warn: #b57d13;
  --warn-soft: #faf1dd;
  --err: #c0342b;
  --err-soft: #f9e6e4;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 20, 40, .04), 0 10px 26px rgba(20, 20, 40, .055);
  --shadow-lift: 0 6px 14px rgba(20, 20, 40, .09), 0 20px 46px rgba(20, 20, 40, .11);

  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Geist", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Header / brand ---------- */

.site-header {
  max-width: 880px;
  margin: 0 auto;
  padding: 2.6rem 1.25rem 0;
  text-align: center;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: .28rem;
  padding-bottom: .35rem;
  border-bottom: 3px solid var(--accent);
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-dos { font-weight: 700; }
.brand-design { font-weight: 400; color: var(--ink-soft); }

.site-title {
  margin: 1.4rem 0 .3rem;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -.01em;
}

.site-sub {
  margin: 0 0 1.4rem;
  color: var(--ink-muted);
  font-size: .95rem;
}

/* ---------- Tabs ---------- */

.tabs {
  display: inline-flex;
  gap: .25rem;
  padding: .3rem;
  background: #ececf1;
  border-radius: 999px;
}

.tab {
  padding: .45rem 1.1rem;
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: .9rem;
  text-decoration: none;
  transition: background .18s var(--ease), color .18s var(--ease), box-shadow .18s var(--ease);
}
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(20, 20, 40, .08);
}

/* ---------- Main / cards ---------- */

.app-main {
  max-width: 880px;
  margin: 0 auto;
  padding: 2rem 1.25rem 1rem;
}

.app-main > section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.6rem;
  animation: rise .5s var(--ease) both;
}

.app-main > section > h1 {
  margin: 0 0 1.1rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.01em;
}

h2 {
  margin: 1.6rem 0 .7rem;
  font-size: 1rem;
  font-weight: 700;
}

/* Expiring rental badge (D-04). */
.badge-expiring {
  display: inline-block;
  padding: .08rem .4rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--warn);
  background: var(--warn-soft);
  border: 1px solid var(--warn);
  border-radius: 999px;
}

/* ---------- Tables ---------- */

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  margin: .4rem 0 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: .92rem;
}

thead th {
  background: #fafafb;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}

th, td {
  padding: .55rem .7rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .14s var(--ease); }
tbody tr:hover { background: #fafafc; }

/* ---------- Forms ---------- */

label {
  display: block;
  margin: .9rem 0 .3rem;
  font-weight: 600;
  font-size: .88rem;
  color: var(--ink-soft);
}

input, select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: .55rem .7rem;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------- Buttons ---------- */

button {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  background: var(--dark);
  border: 1px solid var(--dark);
  border-radius: var(--radius-sm);
  padding: .55rem 1rem;
  transition: transform .12s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease), opacity .16s var(--ease);
}
button:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
button:active { transform: translateY(0) scale(.98); }
button:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }

.auth-login form > button[type="submit"] {
  width: 100%;
  margin-top: 1.3rem;
  padding: .8rem 1rem;
  font-size: 1rem;
}

/* ---------- Flash banner ---------- */

.flash {
  border: 1px solid var(--line);
  border-left: 5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: .65rem .85rem;
  margin: .2rem 0 1.1rem;
  font-weight: 600;
  animation: slide-in .4s var(--ease) both;
}
.flash-ok    { border-left-color: var(--ok);     background: var(--ok-soft); }
.flash-warn  { border-left-color: var(--warn);   background: var(--warn-soft); }
.flash-error { border-left-color: var(--err);    background: var(--err-soft); }

.auth-error, .form-error {
  border-left: 5px solid var(--err);
  background: var(--err-soft);
  border-radius: var(--radius-sm);
  padding: .65rem .85rem;
  margin: 0 0 1rem;
  font-weight: 600;
  animation: slide-in .4s var(--ease) both;
}

/* ---------- Footer ---------- */

.site-footer {
  max-width: 880px;
  margin: 1rem auto 2.4rem;
  padding: 0 1.25rem;
  text-align: center;
  color: var(--ink-muted);
  font-size: .82rem;
  font-family: "Geist Mono", ui-monospace, monospace;
}

/* ---------- Animations ---------- */

@keyframes rise {
  0%   { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes slide-in {
  0%   { opacity: 0; transform: translateY(-6px); }
  100% { opacity: 1; transform: translateY(0); }
}

.app-main > section:nth-child(2) { animation-delay: .05s; }
.app-main > section:nth-child(3) { animation-delay: .1s; }
.app-main > section:nth-child(4) { animation-delay: .15s; }

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

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
  .app-main > section { padding: 1.15rem 1rem; }
  .tabs { flex-wrap: wrap; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
}
