/* Winter Mason back office.
   The colours are the website's: warm beige, deep brown and off-white. */

:root {
  --sand: #d4bc9e;
  --sand-light: #eadcc8;
  --sand-pale: #f5f1ea;
  --cream: #fdfaf5;
  --bark: #4a342a;
  --bark-soft: #6b5044;
  --ink: #2f2f2f;
  --muted: #7a7169;
  --line: #e3ddd4;
  --white: #fff;

  --ok: #2f6b4f;
  --ok-bg: #e8f2ec;
  --warn: #8a6100;
  --warn-bg: #fbf1dc;
  --bad: #b3261e;
  --bad-bg: #fbeae9;
  --info-bg: #eef1f6;
  --info: #35507a;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(74, 52, 42, .06), 0 4px 16px rgba(74, 52, 42, .06);
  --sidebar-width: 236px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--bark); }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 600; color: var(--bark); }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }

/* ---- Frame ---------------------------------------------------------------------------------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: var(--bark);
  color: var(--sand-light);
  padding: 1.25rem 0 1rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { padding: 0 1.25rem 1.25rem; }
.brand strong { display: block; color: var(--white); font-size: 1rem; letter-spacing: .04em; }
.brand span { display: block; font-size: .75rem; color: var(--sand); letter-spacing: .08em; text-transform: uppercase; margin-top: .15rem; }

.nav { flex: 1; overflow-y: auto; }
.nav-group { padding: .5rem 0; }
.nav-group > span {
  display: block; padding: .35rem 1.25rem; font-size: .68rem; letter-spacing: .1em;
  text-transform: uppercase; color: rgba(234, 220, 200, .5);
}
.nav a {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem 1.25rem; color: var(--sand-light); text-decoration: none; font-size: .9rem;
  border-left: 3px solid transparent;
}
.nav a:hover { background: rgba(255, 255, 255, .06); color: var(--white); }
.nav a.current { background: rgba(255, 255, 255, .1); color: var(--white); border-left-color: var(--sand); font-weight: 600; }
.nav svg { width: 17px; height: 17px; flex: none; opacity: .85; }

.sidebar-foot { padding: .9rem 1.25rem 0; border-top: 1px solid rgba(255, 255, 255, .1); font-size: .8rem; }
.sidebar-foot .who { color: var(--white); font-weight: 600; }
.sidebar-foot .role { color: var(--sand); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.sidebar-foot a { color: var(--sand-light); text-decoration: none; }
.sidebar-foot a:hover { text-decoration: underline; }
.sidebar-foot form { margin-top: .4rem; }
.sidebar-foot button {
  background: none; border: 0; padding: 0; color: var(--sand-light);
  font: inherit; font-size: .8rem; cursor: pointer; text-decoration: underline;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.75rem; background: var(--white); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { margin: 0; }
.topbar .sub { color: var(--muted); font-size: .85rem; margin: .1rem 0 0; }
.topbar-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

.content { padding: 1.5rem 1.75rem 3rem; flex: 1; }
.content > section { margin-bottom: 1.5rem; }

.menu-toggle { display: none; }

/* ---- Cards and tables ------------------------------------------------------------------------ */

.card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card + .card { margin-top: 1.25rem; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .9rem 1.15rem; border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 1.15rem; }
.card-body.tight { padding: .6rem 1.15rem; }
.card-foot { padding: .8rem 1.15rem; border-top: 1px solid var(--line); background: var(--sand-pale); border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 1.25rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 1.25rem; align-items: start; }

.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; box-shadow: var(--shadow); }
.stat .label { font-size: .75rem; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.stat .value { font-size: 1.85rem; font-weight: 600; color: var(--bark); line-height: 1.15; margin-top: .25rem; }
.stat .note { font-size: .8rem; color: var(--muted); margin-top: .15rem; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead th {
  text-align: left; font-size: .72rem; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; padding: .6rem 1.15rem; border-bottom: 1px solid var(--line);
  background: var(--sand-pale); white-space: nowrap;
}
tbody td { padding: .7rem 1.15rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--sand-pale); }
td.right, th.right { text-align: right; }
td.nowrap, th.nowrap { white-space: nowrap; }
.table-wrap { overflow-x: auto; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--sand-light); color: var(--bark);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; flex: none;
}
.person { display: flex; align-items: center; gap: .6rem; }
.person a { font-weight: 600; text-decoration: none; }
.person a:hover { text-decoration: underline; }
.person .email { color: var(--muted); font-size: .8rem; }

/* ---- Buttons, pills, badges ------------------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; gap: .4rem; justify-content: center;
  padding: .5rem .9rem; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--white); color: var(--bark); font: inherit; font-size: .875rem; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--sand-pale); }
.btn.primary { background: var(--bark); border-color: var(--bark); color: var(--white); }
.btn.primary:hover { background: var(--bark-soft); }
.btn.danger { color: var(--bad); border-color: #e9cfcd; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.small { padding: .32rem .6rem; font-size: .8rem; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.badge {
  display: inline-block; padding: .17rem .5rem; border-radius: 999px;
  font-size: .72rem; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
  background: var(--sand-pale); color: var(--bark-soft); border: 1px solid var(--line);
}
.badge.new, .badge.enquiry { background: var(--info-bg); color: var(--info); border-color: #d6dded; }
.badge.contacted, .badge.quoted { background: var(--warn-bg); color: var(--warn); border-color: #eeddb8; }
.badge.qualified, .badge.proposal, .badge.booked { background: #efe7f7; color: #5a3d86; border-color: #ded1ee; }
.badge.client, .badge.delivered, .badge.sent, .badge.published { background: var(--ok-bg); color: var(--ok); border-color: #cfe4d8; }
.badge.archived, .badge.lost, .badge.failed { background: var(--bad-bg); color: var(--bad); border-color: #ecd3d1; }
.badge.draft { background: var(--sand-pale); color: var(--muted); }
.badge.sending, .badge.scheduled { background: var(--warn-bg); color: var(--warn); border-color: #eeddb8; }

.tag {
  display: inline-block; padding: .1rem .45rem; border-radius: var(--radius-sm);
  font-size: .72rem; font-weight: 600; background: var(--sand-light); color: var(--bark);
}

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

label { display: block; font-size: .82rem; font-weight: 600; color: var(--bark); margin-bottom: .25rem; }
.field { margin-bottom: 1rem; }
.field .hint { font-size: .78rem; color: var(--muted); margin-top: .25rem; }
.field .error { font-size: .78rem; color: var(--bad); margin-top: .25rem; }

input[type=text], input[type=email], input[type=password], input[type=date], input[type=number],
input[type=search], input[type=url], input[type=datetime-local], select, textarea {
  width: 100%; padding: .5rem .65rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; font-size: .9rem; background: var(--white); color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--sand); outline-offset: -1px; border-color: var(--sand);
}
input[aria-invalid=true], textarea[aria-invalid=true] { border-color: var(--bad); }
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; min-height: 320px; }
select { appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%237a7169' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .6rem center; background-size: 11px; padding-right: 1.8rem; }
.check { display: flex; align-items: flex-start; gap: .5rem; margin-bottom: .5rem; }
.check input { margin-top: .25rem; flex: none; }
.check label { margin: 0; font-weight: 500; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .9rem 1rem; margin: 0 0 1rem; }
legend { font-size: .82rem; font-weight: 600; color: var(--bark); padding: 0 .35rem; }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1rem; }

.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin-bottom: 0; min-width: 150px; }
.filters .grow { flex: 1; min-width: 220px; }

/* ---- Messages -------------------------------------------------------------------------------- */

.flash { padding: .7rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: .9rem; border: 1px solid; }
.flash.success { background: var(--ok-bg); color: var(--ok); border-color: #cfe4d8; }
.flash.error { background: var(--bad-bg); color: var(--bad); border-color: #ecd3d1; }
.flash.info { background: var(--info-bg); color: var(--info); border-color: #d6dded; }

.empty { padding: 2.5rem 1.15rem; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--bark); margin-bottom: .3rem; font-size: 1rem; }

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }

/* ---- Timeline -------------------------------------------------------------------------------- */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .8rem 0 .8rem 1.15rem; border-left: 2px solid var(--line); position: relative; }
.timeline li::before {
  content: ''; position: absolute; left: -5px; top: 1.15rem;
  width: 8px; height: 8px; border-radius: 50%; background: var(--sand); border: 2px solid var(--white);
}
.timeline .when { font-size: .75rem; color: var(--muted); }
.timeline .what { font-weight: 600; color: var(--bark); }
.timeline .body { margin-top: .2rem; font-size: .9rem; }
.timeline .body p { margin: 0 0 .4rem; }

/* ---- Pipeline board -------------------------------------------------------------------------- */

.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: .9rem; overflow-x: auto; padding-bottom: .5rem; align-items: start; }
.column { background: var(--sand-pale); border: 1px solid var(--line); border-radius: var(--radius); }
.column header { padding: .65rem .8rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.column header strong { font-size: .82rem; color: var(--bark); }
.column header .count { font-size: .75rem; color: var(--muted); }
.column .cards { padding: .6rem; display: flex; flex-direction: column; gap: .5rem; min-height: 60px; }
.mini {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .55rem .65rem; font-size: .85rem; text-decoration: none; color: var(--ink); display: block;
}
.mini:hover { border-color: var(--sand); }
.mini strong { display: block; color: var(--bark); }
.mini .meta { color: var(--muted); font-size: .76rem; margin-top: .15rem; }

/* ---- Progress -------------------------------------------------------------------------------- */

.bar { height: 7px; background: var(--sand-pale); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bar span { display: block; height: 100%; background: var(--sand); }
.bar.good span { background: var(--ok); }

/* ---- Pagination ------------------------------------------------------------------------------ */

.pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 1.15rem; border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); }
.pager .links { display: flex; gap: .4rem; }

/* ---- Sign-in and standalone pages ------------------------------------------------------------ */

.centre { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: var(--sand-pale); }
.panel { width: 100%; max-width: 400px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.75rem; }
.panel .brandmark { text-align: center; margin-bottom: 1.4rem; }
.panel .brandmark strong { display: block; font-size: 1.1rem; color: var(--bark); letter-spacing: .04em; }
.panel .brandmark span { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* ---- Email preview --------------------------------------------------------------------------- */

.preview-frame { width: 100%; height: 640px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--white); }

/* ---- Narrow screens -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%; flex: none; height: auto; position: static;
    padding: .75rem 0; flex-direction: column;
  }
  .nav { display: none; }
  .sidebar.open .nav { display: block; }
  .sidebar.open .sidebar-foot { display: block; }
  .sidebar-foot { display: none; }
  .brand { display: flex; justify-content: space-between; align-items: center; padding: 0 1rem; }
  .menu-toggle {
    display: inline-flex; background: none; border: 1px solid rgba(255, 255, 255, .25);
    color: var(--sand-light); border-radius: var(--radius-sm); padding: .35rem .6rem; font: inherit;
    font-size: .8rem; cursor: pointer;
  }
  .topbar { flex-direction: column; align-items: flex-start; gap: .6rem; padding: .9rem 1rem; }
  .content { padding: 1rem 1rem 2.5rem; }
  thead { display: none; }
  table.stack tbody td { display: block; padding: .35rem 1rem; border: 0; }
  table.stack tbody tr { display: block; border-bottom: 1px solid var(--line); padding: .5rem 0; }
}

/* ---- Booking calendar -------------------------------------------------------------------------- */
.month {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
}
.month-heading {
  background: var(--sand-pale); color: var(--muted); font-size: .75rem; letter-spacing: .06em;
  text-transform: uppercase; padding: .45rem .5rem; text-align: center;
}
.month-day { background: var(--white); min-height: 6.5rem; padding: .35rem .4rem; }
.month-day.is-empty { background: var(--cream); }
.month-day.is-today { box-shadow: inset 0 0 0 2px var(--sand); }
.month-date { font-size: .8rem; color: var(--muted); margin-bottom: .25rem; }
.month-item {
  display: block; text-decoration: none; color: var(--ink); font-size: .75rem; line-height: 1.3;
  border-radius: var(--radius-sm); padding: .2rem .35rem; margin-bottom: .2rem;
  background: var(--sand-pale); border: 1px solid var(--line);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.month-item:hover { border-color: var(--sand); }
.month-item strong { font-weight: 600; margin-right: .25rem; }
.month-item.scheduled { background: var(--warn-bg); border-color: #eeddb8; }
.month-item.client { background: var(--ok-bg); border-color: #cfe4d8; }
.month-item.lost { background: var(--bad-bg); border-color: #ecd3d1; text-decoration: line-through; }

@media (max-width: 720px) {
  .month { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .month-day { min-height: 4.5rem; font-size: .7rem; }
  .month-item span { display: none; }
}

@media print {
  .sidebar, .topbar-actions, .btn { display: none; }
  body { background: #fff; }
}
