:root {
  --cream: #F2E6D8;
  --sand: #BFA393;
  --gold: #FECB84;
  --ochre: #B4703C;
  --brown: #592D1D;
  --red: #761113;
  --bright: #D72027;
  --ink: #2d1a14;
  --white: #fff;
  --line: #ddcdbf;
  --ok: #2c6b43;
  --bg: #f8f4ef;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

.app {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.side {
  background: linear-gradient(180deg, #4a2117, #761113);
  color: white;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.logo {
  background: white;
  border-radius: 12px;
  padding: 9px;
  margin-bottom: 20px;
}
.nav button {
  width: 100%;
  border: 0;
  background: transparent;
  color: white;
  text-align: left;
  padding: 12px;
  border-radius: 9px;
  margin: 3px 0;
}
.nav button.active,
.nav button:hover { background: rgba(255, 255, 255, .15); }

.main { padding: 18px; }
.top {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.top h1 {
  font-family: Georgia, serif;
  margin: 0;
  font-size: 25px;
}
.top small { color: #6b4a3a; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  border: 1px solid var(--red);
  background: white;
  color: var(--red);
  padding: 9px 13px;
  border-radius: 8px;
}
.btn.primary { background: var(--red); color: white; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #3c241b; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.screen { display: none; }
.screen.active { display: block; }

.hero {
  margin: 18px 0;
  background: linear-gradient(120deg, var(--cream), #fff);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}
.hero h2 {
  font-family: Georgia, serif;
  font-size: 35px;
  margin: 0 0 8px;
}
.hero p { margin: 0 0 14px; max-width: 640px; }
h2.section-title {
  font-family: Georgia, serif;
  font-size: 28px;
  margin: 22px 0 12px;
}

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px;
  box-shadow: 0 5px 18px rgba(67, 38, 26, .06);
}
.card h3 { margin: 0 0 8px; font-family: Georgia, serif; }

.template {
  height: 170px;
  border-radius: 10px;
  padding: 13px;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 3px solid transparent;
}
.template.selected { border-color: var(--gold); }
.t1 { background: linear-gradient(135deg, #761113, #b4703c); }
.t2 { background: linear-gradient(135deg, #183f38, #b4703c); }
.t3 { background: linear-gradient(135deg, #111, #761113); }
.t4 { background: linear-gradient(135deg, #d8b98f, #592d1d); }
.t5 { background: linear-gradient(135deg, #4a264e, #d72027); }

.workspace {
  display: grid;
  grid-template-columns: 290px 1fr 310px;
  gap: 14px;
  margin-top: 18px;
}
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.panel h3 { font-family: Georgia, serif; margin: 0 0 12px; }

.field { margin-bottom: 10px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 5px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
}

.day {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  margin: 8px 0;
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.day span { flex: 1; }
.day.active {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(118, 17, 19, .08);
}
.day-x {
  border: 0;
  background: transparent;
  color: var(--red);
  padding: 0 4px;
  font-size: 16px;
}

.preview {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.cover {
  height: 230px;
  background: linear-gradient(rgba(0,0,0,.25), rgba(0,0,0,.5)),
    url('https://images.unsplash.com/photo-1516026672322-bc52d61a55d5?auto=format&fit=crop&w=1200&q=80') center/cover;
  color: white;
  padding: 25px;
  display: flex;
  flex-direction: column;
  justify-content: end;
}
.cover.t-classic { background-image: linear-gradient(rgba(0,0,0,.25), rgba(0,0,0,.5)), url('https://images.unsplash.com/photo-1489392191049-fc10c97e64b6?auto=format&fit=crop&w=1200&q=80'); }
.cover.t-black { background-image: linear-gradient(rgba(0,0,0,.4), rgba(0,0,0,.65)), url('https://images.unsplash.com/photo-1547471080-7cc2caa01a7e?auto=format&fit=crop&w=1200&q=80'); }
.cover.t-journal { background-image: linear-gradient(rgba(0,0,0,.2), rgba(0,0,0,.5)), url('https://images.unsplash.com/photo-1516426122078-c23e76319801?auto=format&fit=crop&w=1200&q=80'); }
.cover.t-pulse { background-image: linear-gradient(rgba(0,0,0,.25), rgba(0,0,0,.55)), url('https://images.unsplash.com/photo-1549366021-9f761d450615?auto=format&fit=crop&w=1200&q=80'); }
.cover h2 { font-family: Georgia, serif; font-size: 34px; margin: 0; }

.it-day {
  display: grid;
  grid-template-columns: 95px 1fr;
  gap: 15px;
  padding: 17px;
  border-bottom: 1px solid #eee;
}
.badge {
  background: var(--cream);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  font-weight: bold;
  color: var(--red);
  font-size: 12px;
}
.hotel {
  background: #faf5ef;
  border-left: 4px solid var(--ochre);
  padding: 10px;
  margin-top: 8px;
}
.ad {
  margin: 15px;
  background: linear-gradient(120deg, #761113, #592d1d);
  color: white;
  border-radius: 13px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.ad p { margin: 6px 0 0; }

.kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.kpi .card b { font-size: 24px; color: var(--red); }
.kpi .card p { margin: 6px 0 0; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px; border-bottom: 1px solid #eee; text-align: left; }
.table th { color: #6b4a3a; font-size: 13px; }

.pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 20px;
  background: var(--cream);
  font-size: 12px;
}
.pill.on { background: var(--red); color: white; }

.comment {
  padding: 10px;
  border-left: 3px solid var(--red);
  background: #fbf5f2;
  margin: 8px 0;
  border-radius: 6px;
}
.comment p { margin: 6px 0 10px; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
.modal.open { display: flex; }
.modalbox {
  width: min(780px, 94vw);
  max-height: 88vh;
  overflow: auto;
  background: white;
  border-radius: 15px;
  padding: 20px;
}
.close {
  float: right;
  border: 0;
  background: var(--cream);
  border-radius: 50%;
  width: 34px;
  height: 34px;
}

.price-total { font-size: 28px; font-weight: bold; color: var(--red); }
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--brown);
  color: white;
  padding: 12px 16px;
  border-radius: 10px;
  z-index: 80;
  display: none;
  max-width: 360px;
}
.toast.show { display: block; }

.share-url {
  background: var(--cream);
  border-radius: 8px;
  padding: 10px 12px;
  word-break: break-all;
  font-size: 13px;
}

.client-page {
  display: none;
  min-height: 100vh;
  background: var(--bg);
}
.client-page.open { display: block; }
.client-page .app,
.client-page.open ~ .app { }
body.client-mode .app { display: none; }
body.client-mode .client-page { display: block; }
.client-wrap { max-width: 820px; margin: 0 auto; padding: 24px 16px 64px; }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .app { grid-template-columns: 1fr; }
  .side { position: relative; height: auto; }
  .nav { display: flex; overflow: auto; }
  .nav button { min-width: 150px; }
}
@media (max-width: 650px) {
  .grid, .kpi { grid-template-columns: 1fr; }
  .hero { display: block; }
  .main { padding: 9px; }
  .it-day { grid-template-columns: 1fr; }
  .actions { margin-top: 8px; }
  .top { display: block; }
  .cover h2 { font-size: 26px; }
}
