:root {
  --ink: #18221d;
  --muted: #69746e;
  --line: #e5e9e5;
  --paper: #f4f6f3;
  --surface: #ffffff;
  --green: #1f6b4f;
  --green-dark: #14513b;
  --green-soft: #e5f1eb;
  --amber: #b67622;
  --amber-soft: #fbf0dc;
  --coral: #bd5b45;
  --coral-soft: #f9e9e5;
  --blue: #3c67a4;
  --blue-soft: #e9eff8;
  --shadow: 0 14px 40px rgba(24, 34, 29, .08);
  --radius: 18px;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font: 14px/1.5 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 18px 20px; background: #17251f; color: #f7faf8; display: flex; flex-direction: column; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 10px 30px; }
.brand strong { display: block; font: 700 22px/1.1 Georgia, serif; letter-spacing: -.4px; }
.brand small { color: #91a49a; font-size: 11px; letter-spacing: .08em; }
.brand-mark { position: relative; display: inline-block; width: 34px; height: 34px; flex: 0 0 auto; }
.brand-mark i { position: absolute; left: 13px; top: 2px; width: 8px; height: 30px; border-radius: 99px; background: #e8b45a; transform-origin: center; }
.brand-mark i:nth-child(2) { transform: rotate(60deg); background: #dd7658; }
.brand-mark i:nth-child(3) { transform: rotate(120deg); background: #71ae91; }
.brand-mark.large { width: 48px; height: 48px; }
.brand-mark.large i { left: 19px; width: 10px; height: 44px; }
nav { display: grid; gap: 6px; }
.nav-item { border: 0; background: transparent; color: #aebdb5; padding: 12px 14px; border-radius: 12px; text-align: left; cursor: pointer; transition: .18s ease; }
.nav-item span { display: inline-grid; place-items: center; width: 25px; margin-right: 8px; font-size: 18px; }
.nav-item:hover { color: white; background: rgba(255,255,255,.06); }
.nav-item.active { color: white; background: #294438; box-shadow: inset 3px 0 #e8b45a; }
.sidebar-note { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 14px; border: 1px solid rgba(255,255,255,.08); border-radius: 14px; background: rgba(255,255,255,.035); }
.sidebar-note strong, .sidebar-note small { display: block; }
.sidebar-note strong { font-size: 12px; }
.sidebar-note small { color: #91a49a; font-size: 11px; }
.logout-button { margin-top: 9px; padding: 8px 12px; border: 0; border-radius: 9px; color: #91a49a; background: transparent; font-size: 11px; cursor: pointer; }
.logout-button:hover { color: white; background: rgba(255,255,255,.06); }
.pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: #e8b45a; box-shadow: 0 0 0 5px rgba(232,180,90,.12); }
main { min-width: 0; }
.topbar { min-height: 112px; padding: 27px clamp(24px, 4vw, 54px) 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(244,246,243,.93); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px); }
.eyebrow { margin: 0 0 4px; color: #839087; font-size: 10px; font-weight: 800; letter-spacing: .16em; }
h1, h2, h3, p { margin-top: 0; }
.topbar h1 { margin: 0; font: 700 clamp(25px, 3vw, 34px)/1.15 Georgia, serif; letter-spacing: -.5px; }
.top-actions { display: flex; gap: 10px; }
.button { border: 1px solid transparent; border-radius: 11px; padding: 10px 16px; font-weight: 700; cursor: pointer; transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .5; transform: none; }
.button.primary { color: white; background: var(--green); box-shadow: 0 7px 18px rgba(31,107,79,.18); }
.button.primary:hover { background: var(--green-dark); }
.button.ghost { border-color: #d9dfda; background: white; }
.button.ghost:hover { border-color: #bac6bf; }
.button.danger { color: var(--coral); border-color: #ecc7be; background: var(--coral-soft); }
.content { padding: 30px clamp(24px, 4vw, 54px) 48px; max-width: 1500px; margin: auto; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 15px; margin-bottom: 22px; }
.metric-card { min-height: 108px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; gap: 15px; align-items: center; box-shadow: 0 4px 16px rgba(24,34,29,.025); }
.metric-card.accent { color: white; background: var(--green); border-color: var(--green); }
.metric-card small, .metric-card strong { display: block; }
.metric-card small { margin-bottom: 3px; color: var(--muted); font-size: 12px; }
.metric-card.accent small { color: #c8ddd2; }
.metric-card strong { font: 700 29px/1 Georgia, serif; }
.metric-icon { width: 43px; height: 43px; border-radius: 13px; display: grid; place-items: center; background: rgba(255,255,255,.13); font-size: 20px; }
.metric-icon.amber { color: var(--amber); background: var(--amber-soft); }
.metric-icon.green { color: var(--green); background: var(--green-soft); }
.metric-icon.coral { color: var(--coral); background: var(--coral-soft); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 5px 20px rgba(24,34,29,.03); overflow: hidden; }
.panel-heading { min-height: 88px; padding: 21px 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 0 0 3px; font: 700 20px/1.2 Georgia, serif; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.filters { display: flex; gap: 3px; padding: 4px; background: var(--paper); border-radius: 10px; }
.filter { padding: 7px 11px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.filter.active { color: var(--ink); background: white; box-shadow: 0 2px 7px rgba(24,34,29,.08); }
.table-wrap { position: relative; min-height: 230px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { padding: 13px 20px; color: #89938e; background: #fbfcfb; border-bottom: 1px solid var(--line); text-align: left; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
td { padding: 17px 20px; border-bottom: 1px solid #edf0ed; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #fbfcfb; }
.identity { display: flex; align-items: center; gap: 12px; }
.provider-logo { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 10px; font-weight: 900; font-style: normal; }
.provider-logo.gmail { color: #a94438; background: #f9e9e5; }
.provider-logo.outlook { color: #315f99; background: #e7eef8; }
.identity strong, .identity small { display: block; }
.identity strong { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.identity small, .subtle { color: var(--muted); font-size: 11px; }
.method { display: inline-flex; align-items: center; gap: 7px; color: #46534c; font-size: 12px; }
.status { display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; border-radius: 99px; font-size: 11px; font-weight: 800; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.pending { color: var(--amber); background: var(--amber-soft); }
.status.connected { color: var(--green); background: var(--green-soft); }
.status.attention, .status.invalid { color: var(--coral); background: var(--coral-soft); }
.status.running { color: var(--blue); background: var(--blue-soft); }
.container-id { font: 600 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.row-actions { display: flex; justify-content: flex-end; gap: 7px; }
.mini-button, .menu-button { height: 32px; padding: 0 10px; border: 1px solid #dfe4e0; border-radius: 9px; background: white; font-size: 11px; font-weight: 800; cursor: pointer; }
.mini-button:hover, .menu-button:hover { border-color: #aebbb3; }
.mini-button.launch { color: white; border-color: var(--green); background: var(--green); }
.mini-button.authorize { color: var(--green); border-color: #b9d2c5; background: var(--green-soft); }
.mini-button.authorize:hover { border-color: var(--green); }
.auth-state-detail { display: flex; align-items: center; gap: 7px; margin-top: 5px; }
.auth-state-button { padding: 2px 6px; border: 0; border-radius: 6px; color: var(--green); background: var(--green-soft); font-size: 10px; font-weight: 800; cursor: pointer; }
.auth-state-button:hover { color: white; background: var(--green); }
.menu-wrap { position: relative; }
.action-menu { position: absolute; right: 0; top: 37px; width: 180px; z-index: 5; padding: 6px; border: 1px solid var(--line); border-radius: 11px; background: white; box-shadow: var(--shadow); }
.action-menu button { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 7px; background: transparent; text-align: left; font-size: 12px; cursor: pointer; }
.action-menu button:hover { background: var(--paper); }
.action-menu button.remove { color: var(--coral); }
.empty-state { min-height: 330px; display: grid; place-items: center; align-content: center; text-align: center; padding: 40px; }
.empty-state > span { width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 13px; border-radius: 16px; color: var(--green); background: var(--green-soft); font-size: 26px; }
.empty-state h3 { margin: 0 0 4px; }
.empty-state p { color: var(--muted); }
.modal-backdrop { position: fixed; inset: 0; z-index: 40; padding: 24px; display: grid; place-items: center; background: rgba(15,25,20,.58); backdrop-filter: blur(4px); }
.modal { width: min(650px, 100%); max-height: calc(100vh - 48px); overflow-y: auto; padding: 28px; border-radius: 22px; background: white; box-shadow: 0 28px 80px rgba(0,0,0,.22); }
.compact-modal { width: min(500px, 100%); }
.modal-header, .drawer-header { display: flex; justify-content: space-between; align-items: flex-start; }
.modal-header h2, .drawer-header h2 { margin: 0; font: 700 25px/1.2 Georgia, serif; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 9px; background: var(--paper); color: var(--muted); font-size: 22px; cursor: pointer; }
.provider-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 24px 0 20px; }
.provider-switch input { position: absolute; opacity: 0; pointer-events: none; }
.provider-switch label > span { display: grid; grid-template-columns: 38px 1fr; grid-template-rows: auto auto; column-gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; cursor: pointer; }
.provider-switch .provider-logo { grid-row: 1 / 3; }
.provider-switch small { color: var(--muted); font-size: 10px; }
.provider-switch input:checked + span { border-color: var(--green); box-shadow: 0 0 0 2px rgba(31,107,79,.1); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid label, .login-card label { display: grid; gap: 7px; color: #425047; font-size: 12px; font-weight: 700; }
.import-input { display: grid; gap: 7px; color: #425047; font-size: 12px; font-weight: 700; }
.import-input small { color: var(--muted); font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
.form-grid label.wide { grid-column: 1 / -1; }
label em { color: #9aa49e; font-size: 10px; font-style: normal; font-weight: 500; }
input, select, textarea { width: 100%; padding: 0 12px; border: 1px solid #dce2dd; border-radius: 10px; outline: none; color: var(--ink); background: #fcfdfc; }
input, select { height: 43px; }
textarea { padding-block: 11px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31,107,79,.09); }
.security-note { display: flex; gap: 11px; margin-top: 19px; padding: 12px 14px; border-radius: 11px; color: #59675f; background: var(--paper); font-size: 11px; }
.security-note > span { color: var(--green); font-size: 20px; }
.security-note p { margin: 0; }
.form-error { margin: 12px 0 0; padding: 9px 11px; border-radius: 9px; color: var(--coral); background: var(--coral-soft); font-size: 12px; }
.import-result { margin-top: 14px; padding: 13px 14px; border: 1px solid #cde0d5; border-radius: 11px; color: var(--green-dark); background: #f4faf6; }
.import-result strong, .import-result span { display: block; }
.import-result span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.import-result ul { max-height: 150px; margin: 10px 0 0; padding-left: 20px; overflow: auto; color: var(--coral); font-size: 11px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.job-drawer { position: fixed; top: 0; right: 0; z-index: 60; width: min(480px, 94vw); height: 100vh; padding: 26px; display: flex; flex-direction: column; background: #f8faf8; box-shadow: -20px 0 60px rgba(14,25,19,.16); transform: translateX(105%); transition: transform .25s ease; }
.job-drawer.open { transform: translateX(0); }
.drawer-scrim { display: none; position: fixed; inset: 0; z-index: 55; background: rgba(16,25,21,.32); }
.drawer-scrim.open { display: block; }
.job-summary { margin: 24px 0 14px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.job-summary strong, .job-summary span { display: block; }
.job-summary span { color: var(--muted); font-size: 11px; }
.terminal { flex: 1; min-height: 240px; padding: 17px; overflow: auto; border-radius: 14px; color: #cfdbd3; background: #16221d; font: 11px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace; }
.terminal p { margin: 0 0 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.terminal .muted-log { color: #718078; }
.drawer-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 14px; }
.login-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: #17251f; }
.login-card { width: min(410px, 100%); padding: 36px; border-radius: 22px; background: white; box-shadow: 0 25px 80px rgba(0,0,0,.24); }
.login-card h1 { margin: 14px 0 7px; font: 700 28px/1.2 Georgia, serif; }
.login-card > p:not(.eyebrow):not(.form-error) { margin-bottom: 22px; color: var(--muted); }
.wide-button { width: 100%; margin-top: 18px; }
.toast-stack { position: fixed; right: 22px; bottom: 22px; z-index: 120; display: grid; gap: 9px; }
.toast { min-width: 260px; max-width: 390px; padding: 13px 16px; border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 11px; background: white; box-shadow: var(--shadow); animation: slideIn .2s ease; }
.toast.error { border-left-color: var(--coral); }
.job-history { padding: 22px; display: grid; gap: 10px; }
.history-card { padding: 17px; border: 1px solid var(--line); border-radius: 13px; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.user-list { padding: 20px; display: grid; gap: 10px; }
.user-card { min-height: 70px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 12px; align-items: center; }
.user-card strong, .user-card small { display: block; }
.user-card small { color: var(--muted); font-size: 11px; }
.user-avatar { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--green-dark); background: var(--green-soft); font-weight: 900; }
.user-card .button { padding: 7px 11px; font-size: 11px; }
.user-form-grid { margin-top: 24px; }
.authorization-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr); gap: 22px; align-items: start; }
.authorization-form-card, .authorization-result-card { min-height: 540px; }
.authorization-form { padding: 25px; display: grid; gap: 19px; }
.authorization-form label, .code-result label { display: grid; gap: 7px; color: #425047; font-size: 12px; font-weight: 700; }
.authorization-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 4px; }
.authorization-result-card { padding: 34px; text-align: center; }
.authorization-result-card h2 { margin: 7px 0 7px; font: 700 25px/1.2 Georgia, serif; }
.authorization-result-card > p:not(.eyebrow) { max-width: 420px; margin: 0 auto 24px; color: var(--muted); }
.auth-visual { height: 94px; display: grid; place-items: center; }
.auth-ring { position: relative; width: 66px; height: 66px; display: grid; place-items: center; border: 2px solid #bdd5c8; border-radius: 50%; }
.auth-ring::before, .auth-ring::after, .auth-ring i { content: ""; position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.auth-ring::before { top: -5px; }
.auth-ring::after { right: -5px; }
.auth-ring i { bottom: -5px; }
.authorization-result-card.running .auth-ring { animation: spin 2.4s linear infinite; border-style: dashed; }
.authorization-result-card.success .auth-ring { border-color: var(--green); background: var(--green-soft); }
.authorization-result-card.success .auth-ring::before, .authorization-result-card.success .auth-ring::after, .authorization-result-card.success .auth-ring i { background: #71ae91; }
.auth-progress { max-width: 360px; margin: 0 auto 24px; text-align: left; }
.auth-progress > div { position: relative; min-height: 58px; display: flex; gap: 13px; }
.auth-progress > div:not(:last-child)::after { content: ""; position: absolute; left: 6px; top: 18px; bottom: -2px; width: 1px; background: #dce3de; }
.step-dot { position: relative; z-index: 1; width: 13px; height: 13px; margin-top: 3px; flex: 0 0 auto; border: 3px solid white; border-radius: 50%; background: #c9d1cc; box-shadow: 0 0 0 1px #c9d1cc; }
.auth-progress > div.done .step-dot { background: var(--green); box-shadow: 0 0 0 1px var(--green); }
.auth-progress p, .auth-progress strong, .auth-progress small { margin: 0; display: block; }
.auth-progress small { color: var(--muted); font-size: 10px; }
.code-result { margin: 4px 0 18px; padding: 16px; border: 1px solid #cde0d5; border-radius: 13px; background: #f4faf6; text-align: left; }
.code-result textarea { margin-bottom: 10px; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: white; }
.code-result .button { width: 100%; }
.code-result > small { display: block; margin-top: 9px; color: var(--muted); overflow-wrap: anywhere; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideIn { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 1040px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .app-shell { grid-template-columns: 80px minmax(0,1fr); }
  .sidebar { padding-inline: 12px; }
  .brand { justify-content: center; padding-inline: 0; }
  .brand > span:last-child, .nav-item:not(.active) span + *, .sidebar-note div { display: none; }
  .nav-item { font-size: 0; text-align: center; }
  .nav-item span { margin: 0; }
  .sidebar-note { justify-content: center; }
  .authorization-grid { grid-template-columns: 1fr; }
  .authorization-form-card, .authorization-result-card { min-height: auto; }
}
@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 13px 18px; flex-direction: row; align-items: center; }
  .brand { padding: 0; }
  .brand > span:last-child { display: block; }
  .brand small { display: none; }
  .sidebar nav { margin-left: auto; display: flex; }
  .nav-item { font-size: 0; padding: 8px; }
  .sidebar-note { display: none; }
  .logout-button { margin: 0 0 0 4px; }
  .topbar { position: static; min-height: 96px; padding: 20px; }
  .top-actions #refreshButton { display: none; }
  .top-actions { gap: 6px; }
  .top-actions .button { padding-inline: 11px; }
  .content { padding: 20px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 92px; padding: 15px; }
  .metric-icon { display: none; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .filters { width: 100%; overflow-x: auto; }
  th:nth-child(2), td:nth-child(2), th:nth-child(6), td:nth-child(6) { display: none; }
  td, th { padding-inline: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid label.wide { grid-column: auto; }
  .provider-switch { grid-template-columns: 1fr; }
}
@media (max-width: 440px) {
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 78px; }
  th:nth-child(5), td:nth-child(5) { display: none; }
  .modal { padding: 22px; }
}
