/*
 * Shared styles for the modernized V1 pages (Inbox, Manage Feeds, User Management, Settings,
 * Drafts, Outbox, Sent Alerts, Deleted),
 * plus the header and sidebar nav every signed-in page uses.
 * Load after style.css and css/responsive.css. Page-specific styles stay in each page.
 *
 * Corners: panels, cards, tab groups and search fields use --v1-radius; buttons and
 * text inputs use --v1-radius-control.
 */
:root {
	--v1-border: #d6d6d6;
	--v1-border-control: #b5b5b5;
	--v1-border-input: #8a8a8a;
	--v1-divider: #e3e3e3;
	--v1-radius: 6px;
	--v1-radius-control: 4px;
}

/* --- Page panel --------------------------------------------------------------------- */

/* Replaces the square, dark-bordered box-section-inner frame. */
.v1-panel { background: #fff; border: 1px solid var(--v1-border); border-radius: var(--v1-radius); overflow: hidden; }
.box-section-inner.v1-panel { padding-bottom: 8px; }
.v1-panel > .box-title { border-top: none; border-bottom: 1px solid var(--v1-divider); }
.v1-panel > .box-title .row1 { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.v1-panel > .box-title .row1 h2 { margin-left: 0; }

.v1-card { background: #fff; border: 1px solid var(--v1-border); border-radius: var(--v1-radius); overflow: hidden; }

/* --- Buttons -------------------------------------------------------------------------- */

.v1-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--v1-border-control); background: #fff; font-size: 14px; font-weight: 600; padding: 0 12px; min-height: 34px; border-radius: var(--v1-radius-control); color: #222; cursor: pointer; white-space: nowrap; text-decoration: none; }
.v1-button:hover:not(:disabled):not([aria-disabled="true"]) { background: #f1f1f1; color: #222; }
.v1-button:focus-visible { outline: 2px solid var(--theme__color2); outline-offset: 1px; }
.v1-button:disabled, .v1-button[aria-disabled="true"] { opacity: .55; cursor: default; }
.v1-button[aria-disabled="true"] { pointer-events: none; }
.v1-button-primary { background: var(--theme__color1); border-color: var(--theme__color1); color: #fff; }
.v1-button-primary:hover:not(:disabled):not([aria-disabled="true"]) { background: #00124f; color: #fff; }
.v1-button-danger { color: #b3141a; }
.v1-button-danger:hover:not(:disabled) { background: #fdecec; border-color: #e7a3a5; color: #b3141a; }
.v1-button-go { color: #2e7d32; }
.v1-button-go:hover:not(:disabled) { background: #eaf5eb; border-color: #a5cfa8; color: #2e7d32; }
.v1-button-small { min-height: 28px; font-size: 12px; padding: 0 10px; }
.v1-button-large { min-height: 40px; font-size: 15px; padding: 0 18px; }

/* --- Filter tabs, toolbar and search ------------------------------------------------- */

.v1-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.v1-tabs { display: inline-flex; border: 1px solid #c9c9c9; border-radius: var(--v1-radius); overflow: hidden; }
.v1-tab { border: none; background: #fff; padding: 8px 16px; font-size: 15px; font-weight: 600; color: #444; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.v1-tab + .v1-tab { border-left: 1px solid #c9c9c9; }
.v1-tab:hover { background: #f3f4f7; }
.v1-tab:focus-visible { outline: 2px solid var(--theme__color2); outline-offset: -2px; }
.v1-tab[aria-pressed="true"] { background: var(--theme__color1); color: #fff; }
.v1-tab-count { font-size: 12px; font-weight: 700; background: #e6eaf5; color: var(--theme__color1); border-radius: 10px; padding: 1px 8px; min-width: 24px; text-align: center; }
.v1-tab[aria-pressed="true"] .v1-tab-count { background: rgba(255,255,255,0.2); color: #fff; }

.v1-search { position: relative; }
.v1-toolbar .v1-search { flex: 0 1 320px; min-width: 200px; }
.v1-search > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #888; pointer-events: none; }
.v1-search input { width: 100%; text-align: left; padding: 8px 12px 8px 36px; font-size: 15px; border: 1px solid #c9c9c9; border-radius: var(--v1-radius); background: #fff; }
.v1-search input:focus { outline: 2px solid var(--theme__color2); outline-offset: -1px; border-color: transparent; }

@media (max-width: 767px) {
	.v1-toolbar .v1-search { flex-basis: 100%; }
}

@media (max-width: 991px) {
	/* style.css nudges the old square header button sideways at this width. */
	.v1-panel > .box-title .row1 { padding: 8px 12px; }
}

/* --- App shell: header and sidebar nav ------------------------------------------------ */

/*
 * Every signed-in page shares this markup (header.v1-header + aside.v1-sidebar), so change
 * it on all of them together. js/v1-shell.js fills the user chip and wires Log Out; main.js
 * still toggles body.sidebar-opened for the drawer below 1200px.
 */
:root { --v1-header-h: 56px; }

/* style.css clips .main-wrap with overflow: hidden, which stops the sidebar from sticking. */
.main-wrap { overflow: clip; }

.v1-header .header-section-inner { min-height: var(--v1-header-h); padding: 0 24px; gap: 16px; box-shadow: 0 1px 0 rgba(0,0,0,.12); }
.v1-header .header-logo { display: flex; align-items: center; flex-shrink: 0; }
.v1-header .header-logo img { width: auto; height: 34px; }
.v1-header-divider { width: 1px; height: 24px; background: rgba(255,255,255,.25); flex-shrink: 0; }
.v1-header .header-main { margin: 0; flex: 1; min-width: 0; justify-content: flex-start; }
.v1-header-title { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: .01em; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.v1-header-user { display: flex; align-items: center; gap: 10px; flex-shrink: 0; color: #fff; }
.v1-header-user[hidden] { display: none; }
.v1-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--theme__color2); color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; text-transform: uppercase; flex-shrink: 0; }
.v1-header-signout { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border: 1px solid rgba(255,255,255,.3); border-radius: var(--v1-radius-control); background: transparent; color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.v1-header-signout:hover { background: rgba(255,255,255,.12); }
.v1-header-signout:focus-visible, .v1-header .sidebar-open:focus-visible { outline: 2px solid var(--theme__color2); outline-offset: 2px; }

/* The drawer button is a <button> now; style.css shows it below 1200px. */
.v1-header .sidebar-open { margin: 0; padding: 4px 6px; border: none; border-radius: var(--v1-radius-control); background: transparent; line-height: 1; cursor: pointer; }
.v1-header .sidebar-open:hover { background: rgba(255,255,255,.12); }

.v1-sidebar { --top-offset: var(--v1-header-h); width: 240px; padding: 0; background: #fff; border-right: 1px solid var(--v1-divider); }
.v1-sidebar .page-sidebar-inner { position: sticky; top: 0; max-height: 100vh; overflow-y: auto; padding: 18px 12px 24px; }

.v1-nav { display: flex; flex-direction: column; gap: 20px; }
.v1-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.v1-nav-label { margin: 0 0 6px; padding: 0 12px; font-size: 11px; line-height: 1.4; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #858b96; }
.v1-nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--v1-radius); font-size: 14px; line-height: 1.3; color: #3a3f4a; }
.v1-nav-link > i:first-child { width: 16px; text-align: center; font-size: 14px; color: #858b96; flex-shrink: 0; }
.v1-nav-link .v1-nav-ext { margin-left: auto; font-size: 11px; color: #a3a8b2; }
/* style.css sets a:hover/a:focus { color: inherit }, so restate the colour on each state. */
.v1-nav-link:hover, .v1-nav-link:focus { background: #f1f3f7; color: #111; }
.v1-nav-link:hover > i:first-child { color: var(--theme__color1); }
.v1-nav-link:focus-visible { outline: 2px solid var(--theme__color2); outline-offset: -2px; }
.v1-nav-link.is-active, .v1-nav-link.is-active:hover, .v1-nav-link.is-active:focus { background: var(--theme__color1); color: #fff; font-weight: 600; }
.v1-nav-link.is-active > i:first-child { color: #fff; }

@media (max-width: 1199px) {
	/* responsive.css turns .page-sidebar into a fixed drawer under the header here. */
	.v1-sidebar { width: 260px; padding: 0; border-right: none; overflow-y: auto; }
	.v1-sidebar .page-sidebar-inner { position: static; max-height: none; }
	.sidebar-opened::before { content: ""; position: fixed; top: var(--v1-header-h); right: 0; bottom: 0; left: 0; z-index: 99; background: rgba(16,24,40,.35); }
	.v1-header .header-section-inner { padding: 0 16px; gap: 12px; }
}

@media (max-width: 991px) {
	.v1-header .header-logo img { height: 30px; }
	.v1-header-title { font-size: 14px; }
}

@media (max-width: 575px) {
	.v1-header-divider, .v1-header .header-main { visibility: hidden; }
	.v1-header-signout { padding: 0 9px; }
	.v1-header-signout span { display: none; }
}

/* --- Split list pages: Drafts, Outbox, Sent Alerts, Deleted ---------------------------- */

/*
 * Two-pane list + preview used with js/v1-split.js. Mirrors the Inbox's reading pane
 * (index.html keeps its own ib-* copy). Below 992px it shows one pane at a time.
 */
.v1-split { display: flex; height: calc(100vh - var(--v1-header-h) - 40px); min-height: 520px; }

.v1-split-list-pane { width: 380px; flex-shrink: 0; display: flex; flex-direction: column; border-right: 1px solid var(--v1-divider); background: #fafbfc; min-height: 0; }
.v1-split-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 14px 10px; }
.v1-split-head h2 { font-size: 20px; font-weight: 700; color: #000; margin: 0; }
.v1-pill { font-size: 12px; font-weight: 700; background: #e6eaf5; color: var(--theme__color1); border-radius: 10px; padding: 2px 10px; white-space: nowrap; }
.v1-pill.is-zero { background: #eaf5eb; color: #2e7d32; }
.v1-split-controls { display: flex; flex-direction: column; gap: 8px; padding: 0 12px 12px; border-bottom: 1px solid var(--v1-divider); }
.v1-split-controls .v1-search input { padding-top: 7px; padding-bottom: 7px; font-size: 14px; }
.v1-split-controls .v1-tabs { display: flex; }
.v1-split-controls .v1-tab { flex: 1; justify-content: center; padding: 7px 12px; font-size: 14px; }

/* Date range (Sent Alerts, Deleted): a preset menu, with From/To dates for a custom range. */
.v1-range { display: flex; flex-direction: column; gap: 8px; }
.v1-range select, .v1-range input { width: 100%; min-height: 34px; padding: 5px 10px; font-size: 14px; color: #222; background-color: #fff; border: 1px solid #c9c9c9; border-radius: var(--v1-radius); }
.v1-range select:focus, .v1-range input:focus { outline: 2px solid var(--theme__color2); outline-offset: -1px; border-color: transparent; }
.v1-range input[aria-invalid="true"] { border-color: var(--theme__color3); }
.v1-range-custom { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.v1-range-custom[hidden] { display: none; }
.v1-range-custom label { display: flex; flex-direction: column; gap: 3px; margin: 0; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #777; }
.v1-split-list[aria-busy="true"] { opacity: .5; transition: opacity .15s; }

/* Batch bar (Outbox): select-all checkbox and the send button for the checked rows. */
.v1-batch { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.v1-batch label { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 600; color: #444; cursor: pointer; }
.v1-check { width: 16px; height: 16px; margin: 0; accent-color: var(--theme__color1); cursor: pointer; flex-shrink: 0; }

.v1-split-list { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 6px; }
.v1-split-list > li { position: relative; display: flex; align-items: stretch; }
.v1-split-list > li + li { margin-top: 2px; }
.v1-row-check { display: flex; align-items: flex-start; padding: 13px 0 0 8px; margin: 0; cursor: pointer; }
.v1-row { position: relative; flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 10px; text-align: left; border: none; background: transparent; border-radius: var(--v1-radius); padding: 10px 10px 10px 12px; cursor: pointer; color: inherit; }
.v1-split-list > li:hover { background: #eef1f6; border-radius: var(--v1-radius); }
.v1-split-list > li.is-current { background: #fff; border-radius: var(--v1-radius); box-shadow: 0 1px 2px rgba(16,24,40,.06), 0 2px 8px rgba(16,24,40,.08); }
.v1-split-list > li.is-current::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--theme__color1); }
.v1-split-list > li.is-checked { background: #eef3fb; }
.v1-row:focus-visible { outline: 2px solid var(--theme__color2); outline-offset: -2px; }
.v1-split-list > li.is-new { animation: v1-flash 2.4s ease-out both; }
@keyframes v1-flash { from { background: #d9effa; } }
.v1-row-body { flex: 1; min-width: 0; display: block; }
.v1-row-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; line-height: 1.35; font-weight: 600; color: #222; overflow-wrap: anywhere; }
.v1-row-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; color: #777; min-width: 0; }
.v1-row-meta .v1-row-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.v1-row-meta time { flex-shrink: 0; }
.v1-row-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }

.v1-split-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--v1-divider); font-size: 12px; color: #777; }
.v1-split-foot:empty { display: none; }

/* Source logo or monogram */
.v1-logo { width: 36px; height: 36px; flex-shrink: 0; border-radius: var(--v1-radius); border: 1px solid var(--v1-divider); background: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 10px; font-weight: 700; letter-spacing: -.02em; }
.v1-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.v1-logo.is-fda { background: #e8f0fe; color: #1a56b8; border-color: #d3e0fa; }
.v1-logo.is-usda { background: #e7f5ea; color: #237a3b; border-color: #cfe9d5; }
.v1-logo.is-cdc { background: #e2f5f4; color: #12756f; border-color: #c6e9e6; }
.v1-logo.is-other { background: #f0f0f0; color: #555; }

/* Small labels: alert type, PDF, Add Response */
.v1-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; line-height: 1.5; padding: 0 7px; border-radius: 9px; background: #eef0f4; color: #4a5160; white-space: nowrap; }
.v1-badge.is-blue { background: #e6eaf5; color: var(--theme__color1); }
.v1-badge.is-amber { background: #fff4dc; color: #8a5a00; }
.v1-badge.is-red { background: #fdecec; color: #b3141a; }

/* Preview pane */
.v1-split-detail-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #fff; }
.v1-split-bar { display: flex; align-items: center; gap: 8px; min-height: 58px; padding: 10px 16px; border-bottom: 1px solid var(--v1-divider); background: #fff; }
.v1-split-bar .v1-split-label { margin-right: auto; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #888; }
.v1-button.v1-split-back { display: none; margin-right: auto; }
.v1-split-detail { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.v1-detail-head { padding: 20px 28px 16px; border-bottom: 1px solid #eee; }
.v1-detail-title { font-size: 22px; font-weight: 700; line-height: 1.3; color: #111; margin: 0 0 8px; overflow-wrap: anywhere; }
.v1-detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.v1-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 24px; margin: 0; }
.v1-facts dt { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #888; margin: 0 0 2px; }
.v1-facts dd { font-size: 14px; color: #222; margin: 0; overflow-wrap: anywhere; }
.v1-detail-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 16px 28px 28px; }
.v1-preview-frame { display: block; width: 100%; flex: 1; min-height: 560px; border: 1px solid var(--v1-divider); border-radius: var(--v1-radius); background: #f6f7f9; }
.v1-preview-frame.is-auto { flex: none; min-height: 320px; background: #fff; }
.v1-content { max-width: 860px; font-size: 15px; line-height: 1.6; color: #222; overflow-wrap: anywhere; }
.v1-content p { margin: 0 0 14px; font-size: inherit; }
.v1-content img { max-width: 100%; height: auto; }
.v1-content table { max-width: 100%; }
.v1-content a { color: var(--theme__color1); text-decoration: underline; }
.v1-notice { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; margin-bottom: 14px; border-radius: var(--v1-radius); background: #f1f6fc; color: #2a3a55; font-size: 14px; line-height: 1.45; }
.v1-notice > i { margin-top: 3px; }
.v1-notice.is-warn { background: #fff4dc; color: #6b4600; }
.v1-notice.is-error { background: #fdecec; color: #8a1015; }
.v1-notice a { color: inherit; font-weight: 700; text-decoration: underline; }

/* Empty, loading and placeholder states */
.v1-empty { padding: 36px 20px; text-align: center; color: #666; font-size: 14px; }
.v1-empty i { display: block; font-size: 26px; color: #aaa; margin-bottom: 10px; }
.v1-empty.is-error, .v1-empty.is-error i { color: var(--theme__color3); }
.v1-placeholder { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #888; font-size: 15px; text-align: center; padding: 40px 20px; }
.v1-placeholder i { font-size: 34px; color: #c3c3c3; margin-bottom: 12px; }
.v1-placeholder kbd { font-family: inherit; font-size: 12px; border: 1px solid #ccc; border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: #fafafa; color: #555; }
.v1-skeleton { display: flex; gap: 10px; padding: 12px; }
.v1-skeleton > div, .v1-skeleton span { border-radius: 4px; background: linear-gradient(90deg, #eee 25%, #f6f6f6 50%, #eee 75%); background-size: 200% 100%; animation: v1-shimmer 1.2s infinite; }
.v1-skeleton > div { width: 36px; height: 36px; border-radius: var(--v1-radius); flex-shrink: 0; }
.v1-skeleton p { flex: 1; margin: 0; }
.v1-skeleton span { display: block; height: 12px; margin-bottom: 8px; }
@keyframes v1-shimmer { to { background-position: -200% 0; } }

/* Undo / status toast */
.v1-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1060; display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: var(--v1-radius); background: #1f2430; color: #fff; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.v1-toast[hidden] { display: none; }
.v1-toast.is-error { background: #8a1015; }
.v1-toast span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.v1-toast button { flex-shrink: 0; border: none; background: none; padding: 0; color: #7fd0f2; font-weight: 700; cursor: pointer; }

@media (max-width: 991px) {
	.v1-split { display: block; height: auto; min-height: 0; }
	.v1-split-list-pane { width: 100%; border-right: none; }
	.v1-split-list { overflow: visible; }
	.v1-split-detail-pane { display: none; }
	.v1-split.is-detail-open .v1-split-list-pane { display: none; }
	.v1-split.is-detail-open .v1-split-detail-pane { display: flex; }
	.v1-button.v1-split-back { display: inline-flex; }
	.v1-split-bar { position: sticky; top: 0; z-index: 2; padding: 8px 10px; min-height: 0; flex-wrap: wrap; }
	.v1-split-bar .v1-split-label { display: none; }
	.v1-split-detail { overflow: visible; }
	.v1-detail-head { padding: 16px 16px 14px; }
	.v1-detail-title { font-size: 19px; }
	.v1-detail-body { padding: 14px 16px 20px; }
	.v1-preview-frame { min-height: 70vh; }
	.v1-row { padding: 12px 10px 12px 12px; }
}
@media (max-width: 575px) {
	.v1-hide-sm { display: none; }
	.v1-split-bar .v1-button { padding: 0 10px; }
}
