/* Auto Text 2.0 — Shared Styles (DataPoint design language) */
:root {
    --bg: #eef1f3; --surface: #fff; --primary: #0c2b3c; --text: #333;
    --muted: #6b7a85; --accent: #00a7e1; --accent-hover: #008fc7;
    --header: #0c2b3c; --header-text: #fff; --zebra: #f4f6f7;
    --danger: #e53e3e; --border: #d9dee2; --radius: 4px;
    --shadow: 0 1px 3px rgba(0,0,0,.12);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
.btn { padding: 8px 16px; border: none; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; text-align: center; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--muted); }

/* Auth */
.auth-wrapper { display: flex; justify-content: center; align-items: center; min-height: 100vh; }
.auth-card { background: var(--surface); border-radius: var(--radius); box-shadow: 0 10px 40px rgba(0,0,0,.1); padding: 48px 40px; width: 100%; max-width: 380px; text-align: center; }
.auth-card h1 { font-size: 22px; color: var(--primary); margin-bottom: 8px; }
.subtitle { color: var(--muted); font-size: 14px; margin-bottom: 24px; }

/* Navbar — DataPoint-style dark bar */
.navbar { background: var(--header); padding: 0 24px; height: 52px; display: flex; align-items: center; justify-content: space-between; box-shadow: var(--shadow); }
.nav-brand { font-weight: 700; font-size: 16px; color: var(--header-text); }
.nav-user { font-size: 13px; color: #b8cdd9; }
.nav-user a { color: #fff; }

/* Container */
.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); font-size: 13px; }
.table th { background: var(--bg); padding: 10px 14px; text-align: left; font-weight: 600; color: var(--muted); text-transform: uppercase; font-size: 11px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.table tbody tr:nth-child(even) { background: var(--zebra); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-shared { background: #ebf8ff; color: #2c5282; }
.badge-personal { background: #f0fff4; color: #276749; }
.badge-admin { background: #fed7d7; color: #9b2c2c; }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 24px; }
.tab { padding: 8px 16px; border: 1px solid var(--border); border-radius: 6px 6px 0 0; cursor: pointer; background: var(--surface); font-weight: 600; font-size: 13px; color: var(--muted); }
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--primary); }

/* Forms */
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.form-row input, .form-row select, .form-row textarea { padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; flex: 1; min-width: 140px; }
.form-row textarea { min-height: 60px; }
.form-col { flex-direction: column; align-items: stretch; }

/* Add-in task pane */
.addin-header { background: var(--header); color: var(--header-text); padding: 10px 16px; font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: space-between; }
.addin-menu { position: relative; }
.addin-menu button { background: none; border: none; color: #fff; font-size: 16px; cursor: pointer; padding: 0 4px; }
#menu-dropdown { position: absolute; right: 0; top: 24px; background: #fff; border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.15); min-width: 140px; z-index: 10; }
#menu-dropdown a { display: block; padding: 8px 12px; font-size: 13px; font-weight: 400; color: var(--text, #333); text-decoration: none; }
#menu-dropdown a:hover { background: var(--bg); }
.addin-search { padding: 10px; }
.addin-search input { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.addin-section { padding: 8px 16px; }
.addin-section h3 { font-size: 15px; font-weight: 600; color: var(--primary); margin-bottom: 6px; }
.addin-list { list-style: none; }
.addin-item { padding: 8px 10px; cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.addin-item:nth-child(even) { background: var(--zebra); }
.addin-item:hover { background: #e2eef5; }
.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; background: #e2eef5; }
.trigger-chip { margin-left: auto; background: var(--zebra); border: 1px solid var(--border); border-radius: 3px; padding: 1px 5px; font-size: 11px; color: var(--muted); }
.addin-item .icon { font-size: 16px; }
.addin-back { font-size: 12px; color: var(--accent); cursor: pointer; margin-bottom: 8px; }
.addin-preview { padding: 12px 16px; }
.addin-preview-content { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 12px; font-size: 13px; max-height: 200px; overflow-y: auto; margin-bottom: 12px; }
.addin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.addin-meta { font-size: 11px; color: var(--muted); margin-top: 8px; }

/* ── Rich text editor (Quill) ──
   Quill's own CSS only labels its default font/size whitelist, so custom values
   render as blank dropdown entries. Showing data-value covers any value,
   including the ones Word pastes in. Loaded after quill.snow.css so these win. */
.ql-snow .ql-picker.ql-font .ql-picker-label::before,
.ql-snow .ql-picker.ql-font .ql-picker-item::before,
.ql-snow .ql-picker.ql-size .ql-picker-label::before,
.ql-snow .ql-picker.ql-size .ql-picker-item::before { content: attr(data-value); }
.ql-snow .ql-picker.ql-font .ql-picker-label:not([data-value])::before { content: 'Font'; }
.ql-snow .ql-picker.ql-size .ql-picker-label:not([data-value])::before { content: 'Size'; }
/* Font names need more room than Quill's default 108px picker. */
.ql-snow .ql-picker.ql-font { width: 130px; }
.ql-snow .ql-picker.ql-font .ql-picker-options { width: 150px; }
.ql-snow .ql-picker.ql-size { width: 72px; }
/* The task pane is narrow, so the toolbar has to wrap instead of overflow. */
.ql-toolbar.ql-snow { flex-wrap: wrap; border-radius: 6px 6px 0 0; }
.ql-container.ql-snow { border-radius: 0 0 6px 6px; min-height: 160px; }
.ql-editor { min-height: 160px; font-size: 13px; }
.ql-editor.ql-blank::before { font-style: normal; color: var(--muted); }

/* ── In-pane dialogs ──
   The Office WebView does not implement window.alert, confirm or prompt —
   calling them throws — so these stand in for them. */
.at-modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 16px; }
.at-modal-card { background: #fff; border-radius: 8px; padding: 16px; width: 100%;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.at-modal-msg { font-size: 13px; white-space: pre-wrap; margin-bottom: 12px; }
.at-modal-input { width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 13px; margin-bottom: 12px; }
.at-modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Feedback while a pane action is running. Cosmetic only — deliberately no
   pointer-events:none, since actions await the modal above and disabling its
   buttons would deadlock. Repeat clicks are stopped in JS instead. */
.at-busy { cursor: progress; }
.at-busy .addin-section button,
.at-busy .addin-actions button,
.at-busy .addin-back { opacity: .55; }
.at-busy .at-modal button { opacity: 1; }

/* Snippet rows: the label inserts at the cursor, the ⋯ button opens the snippet
   for preview, edit or delete. Editing should be a deliberate click, not
   something you hit on the way to inserting. */
.addin-item-main { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; cursor: pointer; }
.addin-item-more { background: none; border: 1px solid var(--border); border-radius: 4px;
  color: var(--muted); cursor: pointer; font-size: 13px; line-height: 1; padding: 3px 7px; flex: none; }
.addin-item-more:hover { background: #fff; color: var(--primary); }
