@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;0,700;1,500&family=Manrope:wght@400;500;600&display=swap');

:root {
  --ink: #2a2118;
  --ink-soft: #5a4a3a;
  --paper: #f3ebe0;
  --gold: #c4a46a;
  --gold-deep: #8d6b35;
  --glass: rgba(243, 235, 224, 0.14);
  --glass-strong: rgba(243, 235, 224, 0.88);
  --shadow: 0 24px 60px rgba(20, 12, 6, 0.35);
  --line: rgba(255, 245, 230, 0.28);
  --danger: #8b2e2e;
  --ok: #2f5d3a;
  --radius: 18px;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Manrope', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background: #1a140f;
}

a { color: inherit; }

body.page-landing {
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow-x: hidden;
}

.bg {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 18, 36, 0.28) 0%, rgba(12, 20, 28, 0.42) 48%, rgba(12, 14, 18, 0.72) 100%),
    url('../img/ararat-real.jpg?v=5') center 40% / cover no-repeat;
  transform: scale(1.03);
  animation: bgDrift 28s ease-in-out infinite alternate;
  z-index: 0;
}

@keyframes bgDrift {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to { transform: scale(1.08) translate3d(-1.2%, -0.8%, 0); }
}

.landing {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100% - 2rem));
  padding: 2.5rem 1.25rem 3rem;
  text-align: center;
}

.brand {
  margin: 0 auto 1.75rem;
  max-width: 520px;
  animation: rise 1.1s cubic-bezier(.2,.8,.2,1) both;
}

.brand img {
  width: min(100%, 460px);
  height: auto;
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.45));
  border-radius: 8px;
}

.tagline {
  margin: 0.85rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.4vw, 1.55rem);
  font-style: italic;
  color: rgba(243, 235, 224, 0.92);
  letter-spacing: 0.04em;
  animation: rise 1.2s 0.12s cubic-bezier(.2,.8,.2,1) both;
}

.login-panel {
  margin: 1.75rem auto 0;
  width: min(420px, 100%);
  padding: 1.4rem 1.35rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(28, 20, 14, 0.42);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  text-align: left;
  animation: rise 1.25s 0.22s cubic-bezier(.2,.8,.2,1) both;
}

.login-panel h1 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.8rem;
  color: var(--paper);
}

.login-panel p {
  margin: 0 0 1.1rem;
  color: rgba(243, 235, 224, 0.72);
  font-size: 0.92rem;
}

label {
  display: block;
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(243, 235, 224, 0.7);
}

input[type="text"],
input[type="password"],
input[type="url"],
input[type="email"],
input[type="number"],
input[type="file"],
textarea,
select {
  width: 100%;
  margin-bottom: 0.9rem;
  padding: 0.78rem 0.9rem;
  border: 1px solid rgba(255, 245, 230, 0.22);
  border-radius: 12px;
  background: rgba(255, 248, 238, 0.92);
  color: var(--ink);
  font: inherit;
}

input[type="file"] {
  background: rgba(255, 248, 238, 0.18);
  color: var(--paper);
}

textarea { min-height: 90px; resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  border-radius: 999px;
  padding: 0.78rem 1.25rem;
  font: 600 0.95rem/1 var(--font-body);
  cursor: pointer;
  text-decoration: none;
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  color: #1c140e;
  box-shadow: 0 10px 28px rgba(141, 107, 53, 0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--paper);
  border: 1px solid rgba(255, 245, 230, 0.35);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-small {
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
}

.btn-ghost.is-active {
  border-color: rgba(196, 164, 106, 0.7);
  background: rgba(196, 164, 106, 0.16);
  color: #f7ecda;
}

.alert {
  margin: 0 0 0.9rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  font-size: 0.9rem;
}

.alert-error {
  background: rgba(139, 46, 46, 0.18);
  color: #ffd7d7;
  border: 1px solid rgba(255, 180, 180, 0.35);
}

.alert-ok {
  background: rgba(47, 93, 58, 0.16);
  color: #d8f0dd;
  border: 1px solid rgba(170, 220, 180, 0.35);
}

/* Authenticated shell */
body.page-app {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(8, 18, 36, 0.45), rgba(12, 14, 18, 0.78)),
    url('../img/ararat-real.jpg?v=5') center 40% / cover no-repeat;
  background-attachment: scroll;
  color: var(--paper);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.85rem 1.25rem;
  background: rgba(18, 12, 8, 0.55);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-toggle {
  display: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 248, 238, 0.08);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}

.topbar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--paper);
  border-radius: 1px;
  transition: transform .2s ease, opacity .2s ease;
}

.topbar-toggle.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.topbar-toggle.is-open span:nth-child(2) {
  opacity: 0;
}

.topbar-toggle.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.topbar-brand img {
  width: 52px;
  height: 28px;
  object-fit: cover;
  border-radius: 4px;
}

.topbar-brand span {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.06em;
}

.topbar-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.shell {
  width: min(980px, calc(100% - 2rem));
  margin: 2rem auto 3rem;
}

.shell h1 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 4vw, 2.8rem);
}

.shell .lead {
  margin: 0 0 1.75rem;
  color: rgba(243, 235, 224, 0.78);
}

.links {
  display: grid;
  gap: 0.9rem;
}

.link-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 1.1rem 1.2rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(28, 20, 14, 0.45);
  backdrop-filter: blur(10px);
  text-decoration: none;
  transition: border-color .2s ease, transform .2s ease, background .2s ease;
  animation: rise 0.7s cubic-bezier(.2,.8,.2,1) both;
}

.link-row:nth-child(1) { animation-delay: 0.05s; }
.link-row:nth-child(2) { animation-delay: 0.12s; }
.link-row:nth-child(3) { animation-delay: 0.19s; }
.link-row:nth-child(4) { animation-delay: 0.26s; }
.link-row:nth-child(5) { animation-delay: 0.33s; }

.link-row:hover {
  transform: translateY(-2px);
  border-color: rgba(196, 164, 106, 0.55);
  background: rgba(40, 28, 18, 0.62);
}

.link-row h2 {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 600;
}

.link-row p {
  margin: 0;
  color: rgba(243, 235, 224, 0.7);
  font-size: 0.92rem;
}

.link-row .arrow {
  font-size: 1.4rem;
  color: var(--gold);
}

.panel {
  padding: 1.2rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(28, 20, 14, 0.5);
  backdrop-filter: blur(10px);
  margin-bottom: 1.25rem;
}

.panel h2 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: 1.6rem;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th, td {
  padding: 0.7rem 0.55rem;
  border-bottom: 1px solid rgba(255, 245, 230, 0.12);
  text-align: left;
  vertical-align: top;
}

th { color: rgba(243, 235, 224, 0.65); font-weight: 500; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.9rem;
  color: rgba(243, 235, 224, 0.85);
}

.check input { width: auto; margin: 0; }

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.topbar-user {
  opacity: 0.7;
  font-size: 0.9rem;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.back-link { color: var(--gold); text-decoration: none; }
.back-link:hover { text-decoration: underline; }

.muted { color: rgba(243, 235, 224, 0.68); }
.meta {
  margin: 0 0 0.35rem;
  color: rgba(196, 164, 106, 0.95);
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}

.today-panel .today-date {
  margin: -0.4rem 0 0.85rem;
  color: rgba(243, 235, 224, 0.72);
  font-size: 0.95rem;
}

.today-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.today-list a {
  color: inherit;
  text-decoration: none;
}

.today-list a:hover strong {
  color: var(--gold);
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.1rem;
}

.item-list {
  display: grid;
  gap: 0.85rem;
}

.item-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: start;
}

.item-row h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.45rem;
}

.contact-fields p { margin: 0.25rem 0; }
.contact-fields a { color: var(--gold); }

.search-bar .search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.search-bar .search-row input {
  flex: 1 1 220px;
  margin-bottom: 0;
}

.prose p {
  margin: 0 0 0.85rem;
  line-height: 1.55;
  color: rgba(243, 235, 224, 0.9);
}

.prose p:last-child { margin-bottom: 0; }

audio {
  width: 100%;
  margin-top: 0.25rem;
}

.howto {
  margin: 0;
  padding-left: 1.2rem;
  color: rgba(243, 235, 224, 0.85);
  line-height: 1.55;
}

.howto li { margin-bottom: 0.45rem; }

.calc-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.calc-rows {
  display: grid;
  gap: 0.65rem;
}

.calc-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  padding: 0.65rem 0.15rem;
  border-bottom: 1px solid rgba(255, 245, 230, 0.12);
}

.calc-row:last-of-type { border-bottom: 0; }

.calc-row strong {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: #f7ecda;
}

.calc-row-total {
  margin: 0.25rem 0;
  padding: 0.85rem 0.85rem;
  border: 1px solid rgba(196, 164, 106, 0.4);
  border-radius: 12px;
  background: rgba(196, 164, 106, 0.12);
}

.calc-hint { margin: 1rem 0 0; font-size: 0.88rem; }

.calc-field-hint {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
}

.calc-row-sub {
  opacity: 0.92;
  font-size: 0.95rem;
}

.calc-row-amd strong {
  color: var(--gold);
}

.calc-fx-refresh {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: -0.4rem 0 1.25rem;
}

.shell-boiler {
  width: min(1100px, calc(100% - 2rem));
}

.boiler-panel {
  padding: 0;
  overflow: hidden;
  min-height: min(78vh, 820px);
}

.boiler-frame {
  display: block;
  width: 100%;
  height: min(78vh, 820px);
  border: 0;
  background: #1a1d23;
}

.calc-acl-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.calc-acl-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(255, 245, 230, 0.1);
}

.inline-form { display: inline; margin: 0; }

.calc-grant .search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.calc-grant select {
  flex: 1 1 220px;
  margin-bottom: 0;
}

@media (max-width: 860px) {
  .topbar-toggle { display: inline-flex; }

  .topbar-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    padding-top: 0.35rem;
  }

  .topbar-nav.is-open { display: flex; }

  .topbar-nav .btn {
    width: 100%;
    justify-content: flex-start;
  }

  .topbar-user {
    padding: 0.35rem 0.15rem;
  }
}

@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
  .link-row { grid-template-columns: 1fr; }
  .link-row .arrow { display: none; }
  .page-head { flex-direction: column; }
  .item-row { grid-template-columns: 1fr; }
  .shell { width: min(980px, calc(100% - 1.25rem)); margin-top: 1.25rem; }
  .search-bar .search-row input { flex-basis: 100%; }
}
