/* ===== Outlook-style почта ===== */
:root {
  --ob-blue:    #0F6CBD;
  --ob-blue-dk: #0A5BA0;
  --ob-blue-lt: #EAF3FB;
  --ink:        #1b1a19;
  --ink-2:      #605e5c;
  --ink-3:      #8a8886;
  --line:       #e6e4e2;
  --bg:         #faf9f8;
  --white:      #ffffff;
  --sans: "Jost", "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
.mail-body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
.screen[hidden] { display: none !important; }

/* ===== БРЕНД ===== */
.brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 26px; }
.brand-mark { width: 30px; height: 30px; display: inline-flex; }
.brand-mark svg { width: 100%; height: 100%; }
.brand-name { font-size: 22px; font-weight: 600; color: var(--ob-blue); letter-spacing: .01em; }

/* ===== ЭКРАНЫ ВХОДА / ВОССТАНОВЛЕНИЯ ===== */
.auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 80% -10%, #e9f1fb 0%, rgba(233,241,251,0) 55%),
    radial-gradient(900px 500px at -10% 110%, #eef2f6 0%, rgba(238,242,246,0) 55%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 40px 36px 32px;
  box-shadow: 0 16px 48px rgba(0,0,0,.08);
}
.auth-title { font-size: 24px; font-weight: 600; margin: 0 0 6px; }
.auth-sub { font-size: 14px; color: var(--ink-2); margin: 0 0 22px; line-height: 1.5; }
.auth-sub b { color: var(--ink); font-weight: 600; }

.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.field input {
  width: 100%; font-family: inherit; font-size: 15px; color: var(--ink);
  padding: 11px 12px; border: 1px solid #c8c6c4; border-radius: 4px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus { outline: none; border-color: var(--ob-blue); box-shadow: 0 0 0 2px rgba(15,108,189,.18); }

.security-q { font-size: 15px; color: var(--ink-2); margin: 0 0 16px; line-height: 1.5; }
.security-q span { display: inline-block; margin-top: 4px; font-size: 18px; font-weight: 600; color: var(--ink); }
.security-q .security-hint { display: block; margin-top: 5px; font-size: 13px; font-weight: 300; color: var(--ink-3); }

.auth-error {
  font-size: 13px; color: #a4262c; background: #fdf3f4; border: 1px solid #f3d6d8;
  border-radius: 4px; padding: 9px 11px; margin: 0 0 14px;
}
.auth-link { display: inline-block; font-size: 13px; color: var(--ob-blue); margin-bottom: 22px; }
.auth-link:hover { text-decoration: underline; }
.auth-link--center { display: block; text-align: center; margin: 16px 0 0; }

.auth-btn {
  width: 100%; font-family: inherit; font-size: 15px; font-weight: 500; color: #fff;
  background: var(--ob-blue); border: 0; border-radius: 4px; padding: 12px; cursor: pointer;
  transition: background .15s;
}
.auth-btn:hover { background: var(--ob-blue-dk); }
.auth-foot { margin-top: 22px; font-size: 12px; color: var(--ink-3); text-align: center; }

/* ===== ВХОДЯЩИЕ ===== */
.inbox { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }

.ob-topbar {
  display: flex; align-items: center; gap: 12px;
  background: var(--ob-blue); color: #fff; padding: 0 14px; height: 56px; flex: none;
}
.ob-icon-btn { background: none; border: 0; color: #fff; cursor: pointer; padding: 8px; display: inline-flex; border-radius: 4px; }
.ob-icon-btn:hover { background: rgba(255,255,255,.12); }
.ob-icon-btn svg { width: 22px; height: 22px; }
.ob-menu { display: none; }
.ob-logo { display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 600; }
.ob-logo .brand-mark { width: 24px; height: 24px; }
.ob-search {
  flex: 1 1 0; min-width: 0; max-width: 520px; display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.16); border-radius: 4px; padding: 7px 12px;
}
.ob-search svg { width: 18px; height: 18px; color: #eaf2fb; flex: none; }
.ob-search input { flex: 1; min-width: 0; background: none; border: 0; color: #fff; font-family: inherit; font-size: 14px; }
.ob-search input::placeholder { color: #dbe8f7; }
.ob-search input:focus { outline: none; }
.ob-avatar {
  margin-left: auto; width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: #b3a489; color: #fff; border: 0; cursor: pointer; font-size: 13px; font-weight: 600;
}
.ob-avatar:hover { filter: brightness(1.06); }

.ob-body { flex: 1; display: flex; min-height: 0; position: relative; }

/* папки */
.ob-folders { width: 240px; flex: none; background: var(--bg); border-right: 1px solid var(--line); padding: 16px 12px; overflow-y: auto; }
.ob-compose {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 14px; font-weight: 500; color: #fff;
  background: var(--ob-blue); border: 0; border-radius: 4px; padding: 10px; cursor: pointer; margin-bottom: 16px;
}
.ob-compose:hover { background: var(--ob-blue-dk); }
.ob-compose svg { width: 18px; height: 18px; }
.ob-folder-list { display: flex; flex-direction: column; }
.ob-folder { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 4px; font-size: 14px; color: var(--ink); }
.ob-folder:hover { background: #f0eeec; }
.ob-folder.is-active { background: var(--ob-blue-lt); color: var(--ob-blue-dk); font-weight: 500; }
.ob-folder .fi { font-size: 15px; }
.ob-folder em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--ink-3); }

/* список писем */
.ob-list { width: 380px; flex: none; background: var(--white); border-right: 1px solid var(--line); overflow-y: auto; overflow-x: hidden; }
.ob-item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.ob-item:hover { background: #f7f6f5; }
.ob-item.is-active { background: var(--ob-blue-lt); }
.ob-item.is-unread { background: #fff; }
.ob-item.is-unread .ob-item-from,
.ob-item.is-unread .ob-item-subj { font-weight: 600; color: var(--ink); }
.ob-item-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; font-weight: 600; }
.ob-item-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.ob-item-row { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ob-item-from { font-size: 14px; color: var(--ink); min-width: 0; flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ob-item-date { margin-left: auto; font-size: 12px; color: var(--ink-3); flex: none; }
.ob-item-subj { display: block; max-width: 100%; font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ob-item-prev { display: block; max-width: 100%; font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ob-unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ob-blue); flex: none; align-self: center; }
.ob-unread-spacer { width: 8px; flex: none; }

/* область чтения */
.ob-reading { flex: 1; min-width: 0; background: var(--white); overflow-y: auto; }
.ob-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--ink-3); gap: 14px; }
.ob-empty svg { width: 64px; height: 64px; opacity: .5; }

/* пустая папка (Отправленные / Удалённые) */
.ob-folder-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px; padding: 72px 24px; color: var(--ink-3); }
.ob-folder-empty svg { width: 54px; height: 54px; opacity: .4; margin-bottom: 10px; }
.ob-folder-empty-title { font-size: 16px; font-weight: 600; color: var(--ink-2); margin: 0; }
.ob-folder-empty-sub { font-size: 13px; margin: 0; }
.ob-reading-inner { padding: 28px 36px; max-width: 760px; }
.ob-read-back { display: none; align-items: center; gap: 6px; background: none; border: 0; color: var(--ob-blue); font-family: inherit; font-size: 14px; cursor: pointer; padding: 14px 16px; }
.ob-read-back svg { width: 18px; height: 18px; }
.ob-read-subject { font-size: 22px; font-weight: 600; margin: 0 0 20px; line-height: 1.3; }

/* ветка переписки */
.ob-thread { display: flex; flex-direction: column; gap: 16px; }
.ob-msg { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: #fff; }
.ob-msg--me { background: #f2f7fb; border-color: #dbe7f3; }
.ob-msg-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ob-msg-avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 600; }
.ob-msg-from { font-size: 14px; font-weight: 600; color: var(--ink); }
.ob-msg-date { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.ob-msg-text { font-size: 14.5px; line-height: 1.65; color: #2b2a29; }
.ob-msg-text p { margin: 0 0 10px; }
.ob-msg-text p:last-child { margin-bottom: 0; }
.ob-link { color: var(--ob-blue); text-decoration: underline; font-weight: 600; word-break: break-word; }
.ob-link:hover { color: var(--ob-blue-dk); }

/* вложения */
.ob-attach { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 16px; }
.ob-attach-title { font-size: 11px; color: var(--ink-3); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .06em; }
.ob-attach-chip { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; color: var(--ink); background: #fff; font: inherit; cursor: pointer; -webkit-appearance: none; appearance: none; transition: background .12s, border-color .12s; }
.ob-attach-chip:hover { background: var(--ob-blue-lt); border-color: #cfe6fb; }
.ob-attach-ic { font-size: 18px; flex: none; }
.ob-attach-name { font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ob-attach-open { font-size: 12px; color: var(--ob-blue); flex: none; }

/* ===== Модальное окно вложений (лайтбокс) ===== */
.ob-modal { position: fixed; inset: 0; z-index: 200; display: flex; }
.ob-modal[hidden] { display: none; }
.ob-modal-backdrop { position: absolute; inset: 0; background: rgba(20,20,25,.72); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.ob-modal-box { position: relative; margin: auto; display: flex; flex-direction: column; width: min(940px, 94vw); max-height: 92vh; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.45); animation: ob-modal-in .18s ease; }
@keyframes ob-modal-in { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
.ob-modal-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex: none; }
.ob-modal-title { font-size: 14px; font-weight: 600; color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ob-modal-actions { display: flex; gap: 6px; flex: none; }
.ob-modal-zoom, .ob-modal-close { width: 36px; height: 36px; border: 0; background: #f0eeec; border-radius: 8px; cursor: pointer; font-size: 16px; line-height: 1; color: var(--ink); display: flex; align-items: center; justify-content: center; }
.ob-modal-zoom:hover, .ob-modal-close:hover { background: #e4e1de; }
.ob-modal-body { overflow: auto; padding: 16px; background: #f3f2f1; -webkit-overflow-scrolling: touch; }
.ob-modal-img { display: block; max-width: 100%; height: auto; margin: 0 auto; border-radius: 4px; box-shadow: 0 4px 16px rgba(0,0,0,.12); cursor: zoom-in; }
.ob-modal.is-zoomed .ob-modal-body { text-align: center; }
.ob-modal.is-zoomed .ob-modal-img { max-width: none; width: auto; cursor: zoom-out; }

@media (max-width: 600px) {
  .ob-modal-box { width: 100vw; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; }
}

/* ===== АДАПТИВ (телефон) ===== */
@media (max-width: 900px) {
  .ob-list { width: 320px; }
  .ob-folders { width: 210px; }
}
@media (max-width: 720px) {
  .ob-menu { display: inline-flex; }
  .ob-search { max-width: none; }

  /* папки -> выезжающая панель */
  .ob-folders {
    position: absolute; top: 0; left: 0; bottom: 0; z-index: 30;
    width: 264px; transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 0 10px 40px rgba(0,0,0,.18);
  }
  .ob-folders.is-open { transform: translateX(0); }
  .ob-backdrop { position: absolute; inset: 0; z-index: 20; background: rgba(0,0,0,.32); }

  /* список на всю ширину */
  .ob-list { width: 100%; border-right: 0; }

  /* область чтения наезжает поверх списка */
  .ob-reading {
    position: absolute; inset: 0; z-index: 25; transform: translateX(100%);
    transition: transform .25s ease;
  }
  .ob-reading.is-open { transform: translateX(0); }
  .ob-read-back { display: inline-flex; }
  .ob-empty { display: none; }
  .ob-reading-inner { padding: 18px 18px 40px; }
  .ob-read-subject { font-size: 19px; }
}
@media (max-width: 420px) {
  .ob-logo span:not(.brand-mark) { display: none; }
  .ob-topbar { gap: 8px; padding: 0 10px; }
}
