/****************************************************************************************************************
 *   FTP Web Portal — app styles. Loaded after the Intricate base sheets; uses their tokens only.
 ****************************************************************************************************************/

/* Lato is served from @fontsource as woff2; these override the .ttf faces in new-style.css. */
@font-face { font-family: 'Lato'; src: url('/webfonts/lato-latin-400-normal.woff2') format('woff2'); font-weight: normal; font-style: normal; }
@font-face { font-family: 'Lato'; src: url('/webfonts/lato-latin-700-normal.woff2') format('woff2'); font-weight: bold; font-style: normal; }
@font-face { font-family: 'Lato'; src: url('/webfonts/lato-latin-400-italic.woff2') format('woff2'); font-weight: normal; font-style: italic; }
@font-face { font-family: 'Lato'; src: url('/webfonts/lato-latin-700-italic.woff2') format('woff2'); font-weight: bold; font-style: italic; }
@font-face { font-family: 'Lato Light'; src: url('/webfonts/lato-latin-300-normal.woff2') format('woff2'); font-style: normal; }
@font-face { font-family: 'Lato Light'; src: url('/webfonts/lato-latin-300-italic.woff2') format('woff2'); font-style: italic; }

html, body, button, input, select, textarea {
	font-family: 'Lato', sans-serif;
}

/* The legacy base sheets give some elements display/margin rules that beat the hidden attribute
   and centre <aside>/<section>/<nav> with margin:auto; neutralise both for this app. */
[hidden] { display: none !important; }
aside, section, nav { margin: 0; }

body {
	color: #444444;
}

h1 { font-size: 2.5rem; font-weight: bold; }
h2 { font-size: 1.667rem; font-weight: bold; }
h3 { font-family: 'Lato Light'; font-size: 1.667rem; font-weight: normal; text-transform: uppercase; }
h4 { font-size: 1rem; font-weight: bold; }
h5 { font-family: 'Lato Light'; font-size: 1rem; font-style: italic; font-weight: normal; }
h6 { font-size: 2.083rem; font-weight: normal; color: var(--primary); }

/* ---- Header ------------------------------------------------------------------------------ */

.new-ui-topheader.app-header {
	padding-left: var(--size-6);
	align-items: center;
	box-sizing: border-box;
}

.brand {
	display: flex;
	align-items: center;
	gap: var(--size-6);
	color: white;
	text-decoration: none;
}

.brand .new-logo {
	height: 4rem;
	margin-top: 0;
}

.brand-title {
	font-size: 1.667rem;
	font-weight: bold;
	letter-spacing: 0.02rem;
}

.brand-subtitle {
	font-family: 'Lato Light';
	font-size: 1.4rem;
	text-transform: uppercase;
	color: #EFEFEF;
	padding-left: var(--size-6);
	border-left: var(--size-1) solid rgba(255, 255, 255, 0.5);
}

#new-toprightnav {
	align-items: center;
	gap: var(--size-5);
}

.header-user {
	color: white;
	font-size: 1.2rem;
	text-align: right;
	line-height: 1.3;
}

.header-user .header-user-role {
	display: block;
	font-style: italic;
	color: #EFEFEF;
	font-size: 1rem;
}

/* ---- Breadcrumb ---------------------------------------------------------------------------- */

div.breadcrumb {
	display: flex;
	align-items: center;
	box-sizing: border-box;
}

.crumbs {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--size-3);
}

.crumb {
	background: none;
	border: none;
	padding: var(--size-2) var(--size-4);
	border-radius: var(--size-4);
	color: var(--primary);
	font-style: italic;
	font-size: 1.2rem;
	cursor: pointer;
}

.crumb:hover { background-color: var(--primary-faded); color: var(--primary-dark); }
.crumb:focus { outline: none; box-shadow: 0 0 var(--size-4) var(--primary); }
.crumb.current { color: #7F7F7F; cursor: default; background: none; }
.crumb-sep { color: var(--accent); font-size: 0.9rem; }
.crumb.drop-target { background-color: var(--primary-faded); box-shadow: inset 0 0 0 var(--size-1) var(--primary); }

/* ---- Alert overlays ------------------------------------------------------------------------ */

div.alert-overlay {
	top: 8.5rem;
	border-radius: var(--size-4);
	box-shadow: var(--shadow);
	font-size: 1.25rem;
	min-width: 40rem;
	padding: var(--size-6) var(--size-8) var(--size-6) var(--size-6);
}

div.alert-overlay .alert-close {
	position: absolute;
	top: var(--size-4);
	right: var(--size-4);
	margin: 0;
}

div.alert-overlay.warning .alert-close { color: white; }

/* ---- Explorer layout ----------------------------------------------------------------------- */

.content.explorer-content {
	text-align: left;
	padding: 0;
	min-height: 0;
	height: calc(100vh - 8.1rem); /* viewport minus fixed header + breadcrumb (97px) */
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
}

.toolbar {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--size-2);
	padding: var(--size-4) var(--size-5);
	border-bottom: var(--size-1) solid var(--accent-faded);
	background: white;
}

.toolbar .spacer { flex: 1; }

.toolbar-divider {
	width: var(--size-1);
	height: var(--size-8);
	background-color: var(--accent-faded);
	margin: 0 var(--size-4);
}

.toolbar .text-input-container { margin: 0; min-width: 22rem; }

.button i.fal, .button i.far { margin-right: var(--size-5); }
.button.icon-only i.fal, .button.icon-only i.far { margin-right: 0; }
.button.transparent { padding-left: var(--size-6); padding-right: var(--size-6); }
.button.disabled, .button[disabled] { pointer-events: none; }
.button[disabled]:not(.transparent):not(.secondary) { background-color: var(--accent); border-color: var(--accent); box-shadow: none; }
.button.secondary[disabled] { border-color: var(--accent); color: var(--accent); }
.button.transparent[disabled] { color: var(--accent); }
.button.danger { background-color: var(--secondary); border-color: var(--secondary); }
.button.danger:hover { background-color: #9a3d00; border-color: #9a3d00; }

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

/* Left folder tree — styled like the brand sidebar */
.tree-pane {
	width: 26rem;
	min-width: 14rem;
	max-width: 60vw;
	background-color: var(--primary);
	color: white;
	overflow: auto;
	padding: var(--size-5) 0;
	box-sizing: border-box;
}

.splitter {
	width: var(--size-4);
	cursor: col-resize;
	background-color: var(--accent-faded);
	flex-shrink: 0;
}

.splitter:hover, .splitter.dragging { background-color: var(--accent); }

.tree, .tree ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tree ul { padding-left: var(--size-7); }

.tree-row {
	display: flex;
	align-items: center;
	gap: var(--size-4);
	padding: var(--size-3) var(--size-5);
	cursor: pointer;
	white-space: nowrap;
	border-left: var(--size-3) solid transparent;
	user-select: none;
}

.tree-row:hover { color: #FFDB9F; background-color: rgba(255, 255, 255, 0.08); }
.tree-row.selected { background-color: rgba(255, 255, 255, 0.15); border-left-color: #D07B18; }
.tree-row.drop-target { background-color: rgba(255, 255, 255, 0.3); color: #FFDB9F; }

.tree-toggle {
	width: 1.4rem;
	text-align: center;
	flex-shrink: 0;
	font-size: 0.9rem;
	opacity: 0.85;
}

.tree-toggle.empty { visibility: hidden; }
.tree-row .fal { width: 1.4rem; text-align: center; }
.tree-label { font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; }

/* Right file list */
.files-pane {
	flex: 1;
	overflow: auto;
	position: relative;
	background: white;
	min-width: 0;
}

.files-pane table.tablesorter {
	width: 100%;
	margin: 0;
}

.files-pane table.tablesorter thead {
	position: sticky;
	top: 0;
	background: white;
	z-index: 1;
	box-shadow: 0 var(--size-1) 0 var(--primary);
}

.files-pane table.tablesorter thead th {
	text-transform: uppercase;
	padding: var(--size-4) var(--size-5);
}

.files-pane table.tablesorter input.tablesorter-filter {
	font-size: 1.1rem;
	padding: var(--size-3) var(--size-4);
	border: var(--size-1) solid var(--accent-faded);
	background-color: var(--primary-faded);
}

.files-pane table.tablesorter tbody td {
	padding: var(--size-4) var(--size-5);
	border-top: none;
	border-bottom: var(--size-1) solid var(--accent-faded);
	vertical-align: middle;
}

.file-table tbody tr { cursor: default; user-select: none; }
.file-table tbody tr:hover td { background-color: var(--primary-faded); }
.file-table tbody tr.selected td { background-color: #BCDDE8; }
.file-table tbody tr.drop-target td { background-color: #B7E8F6; box-shadow: inset 0 var(--size-1) 0 var(--primary), inset 0 var(--size--1) 0 var(--primary); }
.file-table tbody tr.cut td { opacity: 0.5; }

.col-name { color: var(--primary); font-weight: bold; word-break: break-word; }
.col-name .fal { width: 1.8rem; text-align: center; margin-right: var(--size-4); font-size: 1.3rem; }
.col-name .fa-folder { color: #D07B18; }
.col-modified { font-style: italic; white-space: nowrap; }
.col-type { text-transform: uppercase; font-size: 0.95rem; color: #7F7F7F; letter-spacing: 0.03rem; }
.col-size { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th.col-size .tablesorter-header-inner { text-align: right; }

.empty-folder {
	text-align: center;
	padding: var(--size-9) var(--size-6);
	color: var(--accent);
}

.empty-folder .fal { font-size: 4rem; display: block; margin-bottom: var(--size-6); color: var(--accent-faded); }

/* Drag & drop upload overlay */
.drop-overlay {
	display: none;
	position: absolute;
	inset: var(--size-5);
	border: var(--size-3) dashed var(--primary);
	border-radius: var(--size-6);
	background-color: rgba(236, 244, 246, 0.92);
	z-index: 5;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	color: var(--primary);
	font-size: 1.667rem;
	font-weight: bold;
	pointer-events: none;
}

.drop-overlay .fal { font-size: 4.5rem; margin-bottom: var(--size-6); }
.explorer.dragging-files .drop-overlay { display: flex; }

.loading-mask {
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.6);
	display: none;
	align-items: center;
	justify-content: center;
	color: var(--primary);
	font-size: 2.5rem;
	z-index: 4;
}

.files-pane.loading .loading-mask { display: flex; }

/* Status bar */
.status-bar {
	display: flex;
	gap: var(--size-7);
	padding: var(--size-3) var(--size-6);
	border-top: var(--size-1) solid var(--accent-faded);
	background-color: #eee;
	color: #7F7F7F;
	font-size: 1.05rem;
}

.status-bar .status-right { margin-left: auto; font-style: italic; }

/* ---- Transfers panel ------------------------------------------------------------------------ */

.transfers {
	position: fixed;
	right: var(--size-7);
	bottom: var(--size-7);
	width: 38rem;
	max-height: 50vh;
	display: none;
	flex-direction: column;
	background: white;
	border-radius: 1rem;
	box-shadow: 0.1rem 0.1rem 0.5rem rgba(0, 0, 0, 0.7), inset 0 0 0 0.08rem #a8a8a8;
	z-index: 6;
	overflow: hidden;
}

.transfers.open { display: flex; }

.transfers-header {
	display: flex;
	align-items: center;
	background-color: var(--primary);
	color: white;
	font-size: 1.3rem;
	font-weight: bold;
	padding: var(--size-4) var(--size-4) var(--size-4) var(--size-6);
}

.transfers-header .title { padding: 0; flex: 1; }
.transfers-header .button.transparent { color: white; margin: 0; padding: var(--size-3) var(--size-5); }
.transfers-header .button.transparent:hover { color: #FFDB9F; }
.transfers.collapsed .transfers-list { display: none; }

.transfers-list {
	list-style: none;
	margin: 0;
	padding: 0;
	overflow: auto;
}

.transfer {
	padding: var(--size-4) var(--size-6);
	border-bottom: var(--size-1) solid var(--accent-faded);
}

.transfer-top { display: flex; align-items: center; gap: var(--size-4); }
.transfer-name { flex: 1; font-weight: bold; color: var(--primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfer-status { font-size: 0.95rem; font-style: italic; color: #7F7F7F; white-space: nowrap; }
.transfer.done .transfer-status { color: #0a0; font-style: normal; font-weight: bold; }
.transfer.failed .transfer-status { color: #F44; font-style: normal; font-weight: bold; white-space: normal; }
.transfer.skipped .transfer-status { color: #D07B18; font-style: normal; font-weight: bold; }
.transfer .button { margin: 0; padding: 0 var(--size-3); }

.progress {
	height: var(--size-4);
	background-color: var(--accent-faded);
	border-radius: var(--size-4);
	margin-top: var(--size-3);
	overflow: hidden;
}

.progress-bar {
	height: 100%;
	width: 0;
	background-color: var(--primary);
	transition: width 0.2s;
}

.transfer.done .progress-bar { background-color: #0a0; }
.transfer.failed .progress-bar, .transfer.skipped .progress-bar { background-color: var(--accent); }

/* ---- Context menu --------------------------------------------------------------------------- */

.context-menu {
	position: fixed;
	z-index: 20;
	display: none;
	min-width: 18rem;
	background: white;
	border-radius: var(--size-4);
	box-shadow: var(--shadow), inset 0 0 0 0.08rem #a8a8a8;
	padding: var(--size-3) 0;
	list-style: none;
	margin: 0;
}

.context-menu.open { display: block; }

.context-menu button {
	display: flex;
	align-items: center;
	gap: var(--size-5);
	width: 100%;
	border: none;
	background: none;
	padding: var(--size-4) var(--size-6);
	font-size: 1.1rem;
	color: #444444;
	text-align: left;
	cursor: pointer;
}

.context-menu button .fal { width: 1.6rem; color: var(--primary); }
.context-menu button:hover, .context-menu button:focus { background-color: var(--primary-faded); outline: none; }
.context-menu button[disabled] { color: var(--accent); pointer-events: none; }
.context-menu button[disabled] .fal { color: var(--accent); }
.context-menu hr { border: none; border-top: var(--size-1) solid var(--accent-faded); margin: var(--size-3) 0; }

/* ---- Modal dialogs (styled after .header-dialog) -------------------------------------------- */

.modal-overlay {
	position: fixed;
	inset: 0;
	background-color: rgba(33, 37, 51, 0.45);
	z-index: 30;
	display: none;
	align-items: flex-start;
	justify-content: center;
	padding-top: 10rem;
}

.modal-overlay.open { display: flex; }

.modal {
	background-color: white;
	border-radius: 1rem;
	box-shadow: 0.1rem 0.1rem 0.5rem rgba(0, 0, 0, 0.7), inset 0 0 0 0.08rem #a8a8a8;
	width: 40rem;
	max-width: calc(100vw - 4rem);
	max-height: calc(100vh - 14rem);
	display: flex;
	flex-direction: column;
	text-align: left;
}

.modal.wide { width: 60rem; }

.modal-header {
	display: flex;
	align-items: center;
	background-color: #227b99;
	color: white;
	min-height: 4.45rem;
	font-size: 1.7rem;
	font-weight: 600;
	padding: 0 var(--size-4) 0 var(--size-6);
	border-radius: 1rem 1rem 0 0;
	box-shadow: inset 0 0 0 0.08rem #a8a8a8;
}

.modal-header .modal-title { flex: 1; }
.modal-header .button.transparent { color: white; font-size: 1.5rem; margin: 0; }
.modal-header .button.transparent:hover { color: #FFDB9F; }

.modal-body {
	padding: var(--size-6);
	overflow: auto;
	font-size: 1.15rem;
	line-height: 1.5;
}

.modal-body p { margin: 0 0 var(--size-5) 0; line-height: 1.5; }

.modal-footer {
	display: flex;
	justify-content: flex-end;
	gap: var(--size-3);
	padding: var(--size-5) var(--size-6);
	border-top: var(--size-1) solid var(--accent-faded);
}

/* ---- Forms ---------------------------------------------------------------------------------- */

.form-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--size-5) var(--size-7);
}

.form-grid .full { grid-column: 1 / -1; }

.field label, .field .field-label {
	display: block;
	font-weight: bold;
	font-size: 1.05rem;
	margin: 0 var(--size-3) var(--size-3);
}

.field .hint {
	display: block;
	font-style: italic;
	color: #7F7F7F;
	font-size: 0.95rem;
	margin: var(--size-2) var(--size-3) 0;
}

.field .text-input-container { margin: 0; }
.text-input { font-size: 1.15rem; }
textarea.text-input { min-height: 5rem; }

.checks {
	display: flex;
	flex-direction: column;
	gap: var(--size-4);
	margin: 0 var(--size-3);
}

.check {
	display: flex;
	align-items: center;
	gap: var(--size-4);
	font-size: 1.1rem;
	cursor: pointer;
}

.check input { width: 1.3rem; height: 1.3rem; accent-color: var(--primary); }

.form-section {
	grid-column: 1 / -1;
	border-top: var(--size-1) solid var(--accent-faded);
	padding-top: var(--size-5);
	margin-top: var(--size-3);
}

.form-section h4 { margin-bottom: var(--size-4); color: var(--primary); }

.form-error {
	color: #f00;
	background-color: #fee;
	border: var(--size-1) solid #f99;
	border-radius: var(--size-4);
	padding: var(--size-5);
	margin-bottom: var(--size-5);
	display: none;
}

.form-error.visible { display: block; }

.inline-result { font-weight: bold; margin-left: var(--size-5); }
.inline-result.ok { color: #0a0; }
.inline-result.bad { color: #F44; }

/* ---- Login ---------------------------------------------------------------------------------- */

.content.login-content {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding-top: 4rem;
}

.login-brand {
	text-align: center;
	margin-bottom: var(--size-7);
}

.login-logo {
	height: 8rem;
	display: block;
	margin: 0 auto var(--size-5);
}

.login-tagline {
	font-family: 'Lato Light';
	font-size: 1.4rem;
	letter-spacing: 0.05rem;
	color: #7F7F7F;
	margin: 0;
}

.login-footer {
	margin: var(--size-7) 0 0;
	font-size: 1rem;
	color: #7F7F7F;
}

.login-footer a { color: var(--primary); text-decoration: none; }
.login-footer a:hover { color: var(--primary-dark); text-decoration: underline; }

.login-card {
	width: 36rem;
	background: white;
	border-radius: 1rem;
	box-shadow: var(--shadow), inset 0 0 0 0.08rem #a8a8a8;
	text-align: left;
	overflow: hidden;
}

.login-card .modal-header { border-radius: 0; }
.login-card form { padding: var(--size-7); display: flex; flex-direction: column; gap: var(--size-6); }
.login-card .button { margin: var(--size-3) 0 0; width: 100%; padding-top: var(--size-6); padding-bottom: var(--size-6); font-size: 1.2rem; }
.login-help { font-style: italic; color: #7F7F7F; font-size: 1rem; text-align: center; margin: 0; }

/* ---- Admin ---------------------------------------------------------------------------------- */

.content.admin-content {
	text-align: left;
	padding: var(--size-7) var(--size-7) var(--size-9);
}

.admin-content .horizontal-tab-button {
	font-size: 1.3rem;
	font-weight: bold;
	color: #444444;
}

.admin-content .horizontal-tab-button .fal { margin-right: var(--size-5); color: var(--primary); }

/* Amber indicator, per the brand rule for badges */
.tab-count {
	display: inline-block;
	margin-left: var(--size-4);
	min-width: 1.5rem;
	padding: 0 var(--size-4);
	border-radius: 1rem;
	background-color: #D07B18;
	color: white;
	font-size: 1rem;
	line-height: 1.5rem;
}
.admin-content .horizontal-tab-content { margin-left: 0 !important; border-radius: 0 var(--size-6) var(--size-6) var(--size-6); }
.admin-content .horizontal-tab-content.active { display: block; }

.section-toolbar {
	display: flex;
	align-items: center;
	gap: var(--size-5);
	margin-bottom: var(--size-6);
}

.section-toolbar h3 { margin: 0; flex: 1; }

.admin-content table.tablesorter thead th { text-transform: uppercase; }

.cell-primary { color: var(--primary); font-weight: bold; }
.cell-sub { display: block; font-weight: normal; font-style: italic; color: #7F7F7F; font-size: 0.95rem; }
.cell-mono { font-family: Consolas, 'Courier New', monospace; font-size: 1.05rem; }
.cell-date { font-style: italic; white-space: nowrap; }
.cell-number { text-align: right; white-space: nowrap; }
.cell-muted { color: #7F7F7F; }
.cell-caps { text-transform: uppercase; font-size: 0.95rem; letter-spacing: 0.03rem; }
.cell-actions { text-align: right; white-space: nowrap; }
.cell-actions .button { margin: 0; }

.status { font-weight: bold; text-transform: uppercase; font-size: 0.95rem; }
.status.active { color: #0a0; }
.status.disabled { color: #F44; }
.status.expired { color: #7F7F7F; }

.perm-chips { display: flex; gap: var(--size-3); flex-wrap: wrap; }

.chip {
	border-radius: 1rem;
	padding: var(--size-1) var(--size-5);
	font-size: 0.9rem;
	background-color: var(--primary-faded);
	color: var(--primary-darker);
	border: var(--size-1) solid #BCDDE8;
}

.chip.off { background-color: #f4f4f4; color: var(--accent); border-color: var(--accent-faded); text-decoration: line-through; }

.info-grid {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: var(--size-5) var(--size-8);
	font-size: 1.2rem;
	margin-bottom: var(--size-7);
}

.info-grid dt { font-weight: bold; }
.info-grid dd { margin: 0; }

/* ---- Responsive (standard breakpoints only) -------------------------------------------------- */

@media only screen and (max-width: 1110px) {
	.brand-subtitle { display: none; }
	.col-type { display: none; }
	.toolbar .text-input-container { min-width: 14rem; }
}

@media only screen and (max-width: 850px) {
	.tree-pane { width: 18rem; }
	.toolbar .button .btn-label { display: none; }
	.toolbar .button i.fal { margin-right: 0; }
	.form-grid { grid-template-columns: 1fr; }
}

@media only screen and (max-width: 600px) {
	.tree-pane, .splitter { display: none; }
	.col-modified { display: none; }
	.transfers { width: calc(100vw - 2rem); right: 1rem; }
}

@media print {
	.toolbar, .tree-pane, .splitter, .transfers, .status-bar { display: none; }
}
