:root {
  --blue: #0F6CBD;
  --blue-h: #115EA3;
  --blue-soft: #CFE4FA;
  --text: #242424;
  --muted: #616161;
  --line: #E1DFDD;
  --pane: #FAF9F8;
  --rail: #EDEBE9;
  --bg: #F3F2F1;
  --white: #fff;
  --danger: #C4314B;
  --rail-w: 68px;
  --top-h: 48px;
  --folder-w: 260px;
  --list-w: 360px;
  --font: "Segoe UI Variable", "Segoe UI", "Segoe UI Web (West European)", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

button, input, textarea { font-family: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login {
  min-height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #fff;
}
.login-hero {
  position: relative;
  min-height: 100%;
  overflow: hidden;
  background: #1b2430;
}
.login-hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.login-logo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  width: auto;
  height: auto;
  max-width: min(320px, 56%);
  max-height: 180px;
  object-fit: contain;
  background: rgba(255,255,255,.9);
  padding: 18px 28px;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,.28);
}
.login-panel {
  display: grid;
  place-items: center;
  background: #fff;
  padding: 32px 16px;
}
.login-card {
  width: min(420px, calc(100% - 32px));
  background: #f3f3f3;
  padding: 40px 36px 28px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.login-card h1 {
  margin: 0;
  text-align: center;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.login-lead { text-align: center; color: var(--muted); margin: 8px 0 22px; }
.login-card label { display: block; font-size: 12px; font-weight: 600; margin: 0 0 14px; }
.login-card input {
  display: block;
  width: 100%;
  margin-top: 6px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #8A8886;
  border-radius: 6px;
  background: #fff;
  font-size: 15px;
}
.login-card input:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
.login-card .error {
  background: #fde7e9;
  color: var(--danger);
  padding: 8px 10px;
  border-radius: 6px;
  margin: 0 0 12px;
}
.login-card button[type=submit] {
  width: 100%;
  height: 42px;
  margin-top: 6px;
  border: 0;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}
.login-card button[type=submit]:hover { background: var(--blue-h); }
.login-copy {
  margin: 22px 0 0;
  text-align: center;
  color: #9a9a9a;
  font-size: 12px;
}
.error { color: var(--danger); font-size: 13px; }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { min-height: 240px; }
  .login-logo { max-height: 96px; padding: 12px 18px; }
}

.app {
  height: 100%;
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  grid-template-rows: var(--top-h) 1fr;
  grid-template-areas:
    "rail top"
    "rail main";
}

.rail {
  grid-area: rail;
  background: var(--rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  gap: 4px;
  overflow: hidden;
}
.rail-logo { width: 36px; height: 36px; object-fit: contain; background: #fff; margin-bottom: 12px; }
.rail-btn {
  width: 56px;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 8px 0 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
}
.rail-btn svg { width: 22px; height: 22px; fill: currentColor; }
.rail-btn:hover { background: rgba(0,0,0,.06); }
.rail-btn.is-on { color: var(--blue); background: #fff; box-shadow: inset 3px 0 0 var(--blue); }
.rail-btn.opts { margin-top: auto; }

.top {
  grid-area: top;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 16px 0 8px;
  gap: 16px;
}
.search {
  flex: 1;
  max-width: 640px;
  margin: 0 auto;
  height: 32px;
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}
.search svg { width: 16px; height: 16px; fill: var(--muted); flex: none; }
.search input {
  border: 0;
  background: transparent;
  width: 100%;
  font-size: 14px;
  outline: none;
}
.top-user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.top-user button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 600;
}

.workspace {
  grid-area: main;
  display: grid;
  grid-template-columns: var(--folder-w) var(--list-w) 1fr;
  min-height: 0;
}

.folders {
  background: var(--pane);
  border-right: 1px solid var(--line);
  padding: 12px 12px 20px;
  overflow: auto;
}
.new-mail {
  width: 100%;
  height: 36px;
  border: 0;
  background: var(--blue);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 14px;
}
.new-mail:hover { background: var(--blue-h); }
.folder-list { display: flex; flex-direction: column; }
.folder-row {
  display: flex;
  align-items: center;
  width: 100%;
}
.folder-twist {
  width: 18px;
  height: 28px;
  flex: 0 0 18px;
  border: 0;
  background: transparent;
  padding: 0;
  color: #8a8886;
}
.folder-twist:not(.is-empty)::before {
  content: "";
  display: block;
  width: 0;
  height: 0;
  margin-left: 6px;
  border-style: solid;
  border-width: 5px 0 5px 6px;
  border-color: transparent transparent transparent currentColor;
}
.folder-twist.is-open::before {
  margin-left: 4px;
  margin-top: 2px;
  border-width: 6px 5px 0 5px;
  border-color: currentColor transparent transparent transparent;
}
.folder-twist.is-empty { visibility: hidden; }
.folder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 32px;
  padding: 0 8px 0 2px;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 14px;
  color: var(--text);
  flex: 1;
  min-width: 0;
}
.folder span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder:hover { background: #EDEBE9; }
.folder.is-on { background: var(--blue-soft); font-weight: 600; box-shadow: inset 3px 0 0 var(--blue); }
.folder .n { color: var(--muted); font-size: 12px; font-weight: 600; }
.folder-row:hover { background: #EDEBE9; }
.folder-row:hover .folder { background: transparent; }
.folder-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  margin-right: 2px;
  gap: 0;
}
.folder-mv {
  height: 22px;
  width: 16px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  line-height: 1;
  padding: 0;
  opacity: 0;
}
.folder-row:hover .folder-mv,
.folder-row.is-on .folder-mv { opacity: 1; }
.folder-mv:disabled { opacity: .25; }
.folder-row:hover .folder-mv:disabled,
.folder-row.is-on .folder-mv:disabled { opacity: .25; }
.folder-menu {
  position: fixed;
  z-index: 80;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0,0,0,.16);
  padding: 4px 0;
}
.folder-menu button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text);
}
.folder-menu button:hover:not(:disabled) { background: var(--blue-soft); }
.folder-menu button:disabled { color: #a19f9d; }

.list-col {
  background: var(--white);
  border-right: 1px solid var(--line);
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.list-head {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}
.list-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.list-head button {
  border: 0;
  background: transparent;
  font-size: 18px;
  color: var(--muted);
}
.msg-list { overflow: auto; flex: 1; }
.msg {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  text-align: left;
  padding: 10px 14px 12px;
  display: block;
}
.msg:hover { background: #F5F5F5; }
.msg.is-on { background: var(--blue-soft); }
.msg.unread .from { font-weight: 700; }
.msg.unread { box-shadow: inset 3px 0 0 var(--blue); }
.msg .row { display: flex; justify-content: space-between; gap: 8px; }
.from { font-size: 14px; }
.when { font-size: 12px; color: var(--muted); white-space: nowrap; }
.subj { font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clip { color: var(--muted); font-size: 12px; }

.read-col {
  min-width: 0;
  background: var(--white);
  display: flex;
  flex-direction: column;
}
.cmd {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}
.cmd button {
  border: 0;
  background: transparent;
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
}
.cmd button:hover { background: #EDEBE9; }
.cmd .danger { color: var(--danger); }
.read { flex: 1; overflow: auto; padding: 20px 28px 40px; }
.read.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
}
.read h3 { margin: 0 0 6px; font-size: 22px; font-weight: 600; }
.meta { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.mail-frame {
  display: block;
  width: 100%;
  min-height: 120px;
  border: 0;
  background: transparent;
}
.atts { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px; }
.atts a {
  display: inline-block;
  padding: 8px 10px;
  background: var(--pane);
  color: var(--blue);
  text-decoration: none;
  font-size: 13px;
}

.module {
  grid-area: main;
  background: var(--white);
  overflow: auto;
  min-height: 0;
  height: 100%;
}
#view-cal:not([hidden]),
#view-people:not([hidden]),
#view-opts:not([hidden]) {
  display: block;
}
.module-bar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}
.module-bar h2 { margin: 0; font-size: 20px; }
.cal-nav { display: flex; gap: 8px; }
.cal-nav button {
  height: 32px;
  min-width: 32px;
  border: 1px solid var(--line);
  background: #fff;
}
.cal-nav .send {
  min-width: auto;
  padding: 0 12px;
  border: 0;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  min-height: calc(100% - 56px);
}
.cal-cell {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  min-height: 110px;
  padding: 8px;
  font-size: 13px;
  cursor: pointer;
}
.cal-cell.head { min-height: 36px; background: var(--pane); font-weight: 600; color: var(--muted); cursor: default; }
.cal-cell.out { color: #c2c2c2; }
.cal-cell.today { background: #F0F7FC; }
.cal-cell.today .d { color: var(--blue); font-weight: 700; }
.cal-ev {
  display: block;
  width: 100%;
  border: 0;
  background: #0F6CBD;
  color: #fff;
  font-size: 11px;
  text-align: left;
  padding: 2px 6px;
  margin-top: 3px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.event-dlg,
.folder-dlg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 50;
  place-items: center;
}
.event-dlg:not([hidden]),
.folder-dlg:not([hidden]) { display: grid; }
.event-dlg[hidden],
.folder-dlg[hidden] { display: none !important; }
.folder-add {
  width: 100%;
  margin-top: 10px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 13px;
  text-align: left;
  padding: 8px 10px;
}
.folder-add:hover { background: #EDEBE9; }
.event-card {
  width: min(440px, calc(100% - 32px));
  background: #fff;
  box-shadow: 0 8px 28px rgba(0,0,0,.2);
}
.event-card label { display: block; padding: 8px 14px 0; font-size: 12px; font-weight: 600; }
.event-card input, .event-card textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  border: 1px solid var(--line);
  padding: 8px;
  font-size: 14px;
}
.event-card .chk { font-weight: 500; }
.event-card .chk input { width: auto; display: inline; margin-right: 8px; }
.people-empty { padding: 48px 32px; max-width: 520px; }
.people-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: 0;
  height: 100%;
}
.people-list-col {
  border-right: 1px solid var(--line);
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.people-list { overflow: auto; flex: 1; }
.p-item {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  text-align: left;
  padding: 12px 16px;
}
.p-item:hover { background: var(--pane); }
.p-item.is-on { background: var(--blue-soft); box-shadow: inset 3px 0 0 var(--blue); }
.p-item .fn { font-weight: 600; display: block; }
.p-item .em { color: var(--muted); font-size: 12px; }
.people-detail { background: #fff; overflow: auto; }
.p-form { padding: 16px 24px 32px; max-width: 560px; }
.p-form-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.p-form h3, .p-form-head h3 { margin: 0; }
.p-form label, .opts label { display: block; padding: 8px 0 0; font-size: 12px; font-weight: 600; }
.p-form input, .p-form textarea, .opts input[type=text], .opts input[type=date], .opts textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  border: 1px solid var(--line);
  padding: 8px;
  font-size: 14px;
}
.opts input[readonly] { background: var(--pane); color: var(--muted); }
.p-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opts { padding: 20px 28px 48px; max-width: 720px; overflow: auto; }
.opts h2 { margin: 0 0 8px; }
.opts h3 { margin: 28px 0 6px; font-size: 16px; }
.opts .chk { font-weight: 500; }
.opts .chk input { width: auto; display: inline; margin-right: 8px; }
.filter-row {
  display: grid;
  grid-template-columns: 28px 120px 1fr 130px 32px;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}
.filter-row select, .filter-row input { width: 100%; height: 32px; border: 1px solid var(--line); padding: 0 8px; }
#opt-filter-add {
  margin-top: 8px;
  border: 1px solid var(--line);
  background: #fff;
  height: 32px;
  padding: 0 12px;
}
.muted { color: var(--muted); }

.compose {
  position: fixed;
  left: 50%;
  top: 6vh;
  width: min(720px, calc(100% - 48px));
  height: min(680px, 88vh);
  background: #fff;
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
  display: none;
  flex-direction: column;
  z-index: 40;
  transform: translateX(-50%);
}
.compose.is-open {
  display: flex;
}
.compose.is-drag {
  transform: none;
}
.compose-head {
  height: 40px;
  background: #323130;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 13px;
  cursor: move;
  user-select: none;
}
.compose-head button {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 22px;
  line-height: 1;
}
.compose input, .compose textarea {
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}
.compose textarea { flex: 1; resize: none; }
.addr-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
}
.addr-row input {
  flex: 1;
  border: 0;
  border-bottom: 0;
}
.addr-btn {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  padding: 0 12px;
  white-space: nowrap;
  cursor: pointer;
}
.addr-suggest {
  position: fixed;
  z-index: 80;
  max-height: 240px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 8px 20px rgba(0,0,0,.12);
}
.addr-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 8px 12px;
  font-size: 13px;
}
.addr-item:hover { background: var(--pane); }
.addr-item b { display: block; }
.addr-item span { color: var(--muted); font-size: 12px; }
.addr-picker {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 90;
  display: grid;
  place-items: center;
}
.addr-picker[hidden] { display: none !important; }
.addr-picker-card {
  width: min(420px, calc(100% - 24px));
  height: min(520px, calc(100% - 24px));
  background: #fff;
  box-shadow: 0 8px 28px rgba(0,0,0,.2);
  display: flex;
  flex-direction: column;
}
.addr-picker-card .compose-head { cursor: default; }
.addr-picker-q {
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}
.addr-picker-list { flex: 1; overflow: auto; }
.attach-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
}
.att-list { display: flex; flex-wrap: wrap; gap: 6px; }
.att-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--pane);
  border: 1px solid var(--line);
  padding: 4px 8px;
  font-size: 12px;
}
.att-chip button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}
.compose-foot {
  padding: 10px 12px;
  display: flex;
  gap: 10px;
}
.send {
  height: 32px;
  min-width: 96px;
  border: 0;
  background: var(--blue);
  color: #fff;
  font-weight: 600;
}
.sig-preview { margin-top: 10px; display: flex; align-items: center; gap: 12px; }
.sig-preview img { max-height: 80px; max-width: 220px; border: 1px solid var(--line); }
.compose-foot #c-sig.is-on { color: var(--blue); font-weight: 600; }
.compose-foot button:not(.send) {
  border: 0;
  background: transparent;
  color: var(--muted);
}

@media (max-width: 980px) {
  .workspace { grid-template-columns: 220px 1fr; }
  .read-col { display: none; }
  .workspace.show-read { grid-template-columns: 1fr; }
  .workspace.show-read .folders,
  .workspace.show-read .list-col { display: none; }
  .workspace.show-read .read-col { display: flex; }
}

.invite-bar {
  margin: 16px 0 0;
  padding: 12px 14px;
  background: #F0F7FC;
  border: 1px solid #CFE4FA;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}
.invite-bar button { flex: none; }

body.compose-page {
  background: #c8c6c4;
  overflow: hidden;
}
body.compose-page .compose {
  position: static;
  transform: none;
  width: 100%;
  height: 100%;
  display: flex;
  box-shadow: none;
}
body.compose-page .compose-head { cursor: default; }
