* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Segoe UI", Tahoma, sans-serif; background: #f1f3f8; color: #1f2937; }

.auth-wrap { width: min(960px, 92%); margin: 48px auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 16px; box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04); }
h1 { font-size: 22px; margin-bottom: 8px; }
h2 { font-size: 16px; margin-bottom: 10px; }
h3 { font-size: 14px; margin-bottom: 8px; color: #1e3a8a; }

.auth-wrap-fancy {
	width: min(1120px, 94%);
	min-height: calc(100vh - 86px);
	align-items: center;
	padding: 18px;
	border-radius: 20px;
	background:
		radial-gradient(circle at 12% 20%, rgba(37, 99, 235, 0.22), transparent 32%),
		radial-gradient(circle at 85% 12%, rgba(139, 92, 246, 0.22), transparent 34%),
		linear-gradient(140deg, #eef2ff 0%, #f8fbff 48%, #eff6ff 100%);
	border: 1px solid #dbe4ff;
	box-shadow: 0 24px 60px rgba(37, 99, 235, 0.12);
}
.auth-hero {
	background: linear-gradient(150deg, #0f172a 0%, #1d4ed8 45%, #6366f1 100%);
	color: #e2e8f0;
	border: none;
	border-radius: 18px;
	padding: 28px;
	box-shadow: 0 16px 36px rgba(30, 58, 138, 0.28);
}
.auth-chip {
	display: inline-block;
	padding: 6px 10px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.12em;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.16);
	border: 1px solid rgba(255, 255, 255, 0.32);
	margin-bottom: 12px;
}
.auth-hero h1 { font-size: 30px; line-height: 1.2; margin-bottom: 10px; color: #fff; }
.auth-copy { font-size: 14px; line-height: 1.6; color: #dbeafe; margin-bottom: 14px; }
.auth-points { list-style: none; display: grid; gap: 8px; }
.auth-points li {
	font-size: 13px;
	color: #e0e7ff;
	padding-left: 18px;
	position: relative;
}
.auth-points li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 7px;
	width: 8px;
	height: 8px;
	border-radius: 999px;
	background: #60a5fa;
	box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.22);
}

.auth-login-card {
	align-self: center;
	padding: 24px;
	border: 1px solid #dbeafe;
	border-radius: 18px;
	background: rgba(255, 255, 255, 0.9);
	backdrop-filter: blur(6px);
	box-shadow: 0 14px 32px rgba(15, 23, 42, 0.09);
}
.auth-login-card h2 {
	font-size: 24px;
	margin-bottom: 4px;
	color: #0f172a;
}
.auth-login-card input {
	margin-top: 10px;
	border: 1px solid #bfdbfe;
	background: #f8fbff;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.auth-login-card input:focus {
	outline: none;
	border-color: #2563eb;
	box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}
.auth-login-card button {
	margin-top: 12px;
	padding: 11px 12px;
	font-size: 14px;
	background: linear-gradient(135deg, #1d4ed8, #7c3aed);
	box-shadow: 0 12px 24px rgba(29, 78, 216, 0.2);
}


input, select, button, textarea {
	width: 100%;
	margin-top: 8px;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	padding: 9px 10px;
	font-size: 14px;
	background: #fff;
}
textarea { min-height: 70px; resize: vertical; }
button { border: none; cursor: pointer; background: #2563eb; color: #fff; font-weight: 600; }
button.secondary { background: #64748b; }
button.ghost { background: #eef2ff; color: #1d4ed8; }
button.danger { background: #dc2626; }

.muted { color: #64748b; font-size: 12px; margin-top: 6px; }
.error { color: #b42318; margin-top: 8px; font-size: 13px; }

.app-topbar {
	position: sticky;
	top: 0;
	z-index: 70;
	display: grid;
	grid-template-columns: 240px 1fr auto;
	gap: 12px;
	align-items: center;
	padding: 10px 16px;
	background: linear-gradient(95deg, #0f172a 0%, #1e293b 48%, #0b1120 100%);
	border-bottom: 1px solid #1f2937;
}
.app-topbar-left {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}
.app-logo {
	width: 38px;
	height: 38px;
	border-radius: 10px;
	background: linear-gradient(135deg, #2563eb, #0ea5e9);
	color: #fff;
	font-weight: 800;
	font-size: 13px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	letter-spacing: 0.08em;
}
.app-company {
	display: grid;
	line-height: 1.2;
}
.app-company strong {
	font-size: 15px;
	color: #f8fafc;
}
.app-company span {
	font-size: 11px;
	color: #bfdbfe;
}
.app-topbar-center {
	position: relative;
}
.global-search-wrap {
	position: relative;
	max-width: 760px;
}
.global-search-wrap input {
	padding-right: 70px;
	border-radius: 12px;
	border: 1px solid #334155;
	background: #f8fafc;
}
.global-search-clear {
	position: absolute;
	top: 50%;
	right: 8px;
	transform: translateY(-50%);
	width: auto;
	padding: 5px 8px;
	font-size: 11px;
	background: #e2e8f0;
	color: #0f172a;
	border-radius: 8px;
}
.global-search-results {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	max-height: 320px;
	overflow: auto;
	background: #fff;
	border: 1px solid #dbe4f0;
	border-radius: 12px;
	padding: 8px;
	box-shadow: 0 18px 36px rgba(15, 23, 42, 0.25);
}
.global-search-result {
	width: 100%;
	text-align: left;
	display: grid;
	gap: 2px;
	padding: 9px 10px;
	border-radius: 10px;
	background: #fff;
	color: #0f172a;
	border: 1px solid #e2e8f0;
	margin-top: 6px;
}
.global-search-result:first-child { margin-top: 0; }
.global-search-result:hover { background: #eff6ff; border-color: #bfdbfe; }
.global-search-result strong { font-size: 13px; }
.global-search-result small { font-size: 11px; color: #64748b; }
.global-search-type {
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #2563eb;
}
.top-user-card {
	display: grid;
	gap: 2px;
	padding: 8px 12px;
	border-radius: 10px;
	background: rgba(148, 163, 184, 0.12);
	border: 1px solid rgba(148, 163, 184, 0.24);
	min-width: 220px;
}
.top-user-name {
	color: #f8fafc;
	font-size: 13px;
	font-weight: 700;
}
.top-user-meta {
	font-size: 11px;
	color: #cbd5e1;
}

.lang-switch {
	display: inline-flex;
	gap: 6px;
	align-items: center;
}
.lang-btn {
	width: auto;
	margin-top: 0;
	padding: 5px 10px;
	font-size: 12px;
	border-radius: 999px;
	border: 1px solid #cbd5e1;
	background: #ffffff;
	color: #334155;
	font-weight: 600;
}
.lang-btn.active {
	background: #1d4ed8;
	border-color: #1d4ed8;
	color: #ffffff;
}
.auth-lang-switch {
	justify-content: flex-end;
	margin-bottom: 8px;
}
.top-lang-switch {
	justify-content: flex-end;
	margin-bottom: 4px;
}

.layout { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 60px); }
.sidebar {
	background: #111827;
	color: #cbd5e1;
	padding: 18px 12px;
	border-right: 1px solid #1f2937;
	display: flex;
	flex-direction: column;
	min-height: calc(100vh - 60px);
}
.sidebar-main { display: grid; }
.brand { font-size: 18px; font-weight: 700; color: #fff; padding: 6px 10px 16px; }
.menu-btn {
	width: 100%;
	text-align: left;
	display: flex;
	align-items: center;
	gap: 8px;
	border-radius: 10px;
	padding: 10px 12px;
	background: transparent;
	color: #dbeafe;
	margin-top: 6px;
}
.menu-btn.active,
.menu-btn:hover { background: #1e3a8a; }
.sidebar-logout {
	margin-top: auto;
	margin-bottom: 4px;
	border: 1px solid #334155;
}
.menu-icon {
	width: 18px;
	height: 18px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	flex: 0 0 18px;
}
.menu-icon svg {
	width: 18px;
	height: 18px;
	display: block;
	opacity: 0.95;
}
.menu-label {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.menu-caret {
	font-size: 11px;
	opacity: 0.85;
}
.submenu-wrap {
	display: grid;
	gap: 4px;
	margin-top: 4px;
	padding-left: 14px;
	border-left: 1px solid #334155;
}
.submenu-btn {
	width: 100%;
	text-align: left;
	display: flex;
	align-items: center;
	gap: 8px;
	border-radius: 8px;
	padding: 8px 10px;
	background: transparent;
	color: #cbd5e1;
	font-size: 13px;
	font-weight: 600;
}
.submenu-btn:hover,
.submenu-btn.active {
	background: #1e40af;
	color: #e0e7ff;
}

.main { padding: 16px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.page-title { font-size: 22px; font-weight: 700; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }

.app-toast {
	position: fixed;
	right: 18px;
	top: 18px;
	z-index: 1600;
	padding: 10px 14px;
	border-radius: 10px;
	font-size: 13px;
	font-weight: 600;
	box-shadow: 0 10px 20px rgba(15, 23, 42, 0.18);
}
.app-toast.success { background: #16a34a; color: #fff; }
.app-toast.error { background: #dc2626; color: #fff; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid #dbe4f0; border-radius: 12px; padding: 14px; }
.kpi span { color: #64748b; font-size: 13px; }
.kpi strong { display: block; margin-top: 6px; font-size: 24px; color: #0f172a; }
.kpi-fx {
	background: linear-gradient(145deg, #eff6ff 0%, #ecfeff 100%);
	border-color: #bae6fd;
}
.kpi-fx strong {
	font-size: 20px;
	color: #0c4a6e;
}

.dash-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 12px; margin-top: 12px; }
.chart-wrap { display: grid; grid-template-columns: 250px 1fr; gap: 10px; align-items: center; }
.pie-box { display: flex; justify-content: center; }
.pie-svg { width: 220px; height: 220px; }
.chart-text { fill: #64748b; font-size: 12px; }
.chart-value { fill: #0f172a; font-size: 12px; font-weight: 700; }
.legend-box { display: grid; gap: 6px; }
.legend-item { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 8px; font-size: 12px; }
.legend-dot { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.legend-item strong { font-size: 12px; color: #0f172a; }

.candle-wrap { overflow-x: auto; }
.candle-svg { width: 100%; min-width: 580px; height: 240px; }
.axis-text { fill: #64748b; font-size: 10px; }

.trend-grid { margin-top: 10px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.trend-col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.trend-col span { font-size: 11px; color: #64748b; }
.trend-bar-wrap { width: 100%; height: 120px; display: flex; align-items: end; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 4px; }
.trend-bar { width: 100%; background: linear-gradient(180deg, #60a5fa, #2563eb); border-radius: 6px; min-height: 6px; }

.table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.table th, .table td { border-bottom: 1px solid #e2e8f0; padding: 9px 6px; text-align: left; }
.row-selected { background: #eef4ff; }

.module-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.toolbar { display: flex; gap: 8px; }
.toolbar button { width: auto; min-width: 86px; }
.btn-with-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
}
.btn-icon {
	width: 14px;
	height: 14px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 14px;
}
.btn-icon svg {
	width: 14px;
	height: 14px;
	display: block;
}

.product-layout { display: grid; grid-template-columns: 290px 1fr; gap: 14px; }
.category-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.category-actions button { width: auto; font-size: 13px; padding: 8px 10px; }
.tree-title { margin-bottom: 2px; }
.tree-box { max-height: 65vh; overflow: auto; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px; background: #fafcff; }
.tree-item { padding: 6px 8px; border-radius: 8px; cursor: pointer; margin-top: 4px; font-size: 13px; }
.tree-item:hover { background: #e5edff; }
.tree-item.active { background: #c7d7fe; color: #1e3a8a; font-weight: 600; }
.tree-folder-icon { margin: 0 4px; }

.product-toolbar { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.product-grid {
	margin-top: 10px;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
	gap: 12px;
}

.saved-preview {
	margin-bottom: 12px;
	border: 1px solid #bbf7d0;
	background: #f0fdf4;
	border-radius: 12px;
	padding: 10px;
}
.saved-preview-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
}
.saved-preview-head strong { color: #166534; font-size: 14px; }
.saved-preview-head button { width: auto; min-width: 70px; }
.saved-preview-body { display: grid; grid-template-columns: 100px 1fr; gap: 10px; align-items: center; }
.saved-preview-image {
	width: 100px;
	height: 80px;
	object-fit: cover;
	border-radius: 8px;
	border: 1px solid #d1fae5;
	background: #fff;
}
.saved-preview-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 8px;
}
.saved-preview-grid div {
	background: #fff;
	border: 1px solid #dcfce7;
	border-radius: 8px;
	padding: 7px 8px;
	display: grid;
	gap: 2px;
}
.saved-preview-grid span { font-size: 11px; color: #166534; }
.saved-preview-grid strong { font-size: 12px; color: #052e16; }
.product-card {
	background: #fff;
	border: 1px solid #dbe3f1;
	border-radius: 10px;
	overflow: hidden;
	position: relative;
}
.product-card.selected { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2); }
.product-check-wrap {
	position: absolute;
	top: 8px;
	right: 8px;
	background: rgba(255, 255, 255, 0.95);
	padding: 3px 6px;
	border-radius: 999px;
	border: 1px solid #cbd5e1;
	z-index: 4;
}
.product-check-wrap input { margin: 0; width: auto; }
.product-image {
	width: 100%;
	height: 120px;
	object-fit: cover;
	background: #f8fafc;
	border-bottom: 1px solid #e2e8f0;
}
.product-body { padding: 8px; font-size: 12px; }
.product-name { font-weight: 600; margin-bottom: 4px; font-size: 13px; }

.modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.45);
	display: flex;
	align-items: stretch;
	justify-content: stretch;
	padding: 0;
	z-index: 999;
}
.modal-box {
	width: 100vw;
	height: 100vh;
	max-width: 100vw;
	background: #fff;
	border-radius: 0;
	padding: 20px;
	border: none;
	overflow-y: auto;
	box-shadow: none;
}
.modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 10px;
	position: sticky;
	bottom: 0;
	padding-top: 10px;
	background: #fff;
}
.modal-actions button { width: auto; min-width: 110px; }

.field-group { margin-top: 10px; }
.field-col { flex: 1; }
.field-label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: #334155;
	margin-top: 8px;
}
.export-format-row {
	justify-content: flex-start;
	gap: 14px;
	margin-top: 8px;
}
.export-option {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	padding: 8px 10px;
	border: 1px solid #dbe4f0;
	border-radius: 8px;
	background: #f8fbff;
}
.export-option input {
	width: auto;
	margin: 0;
}
.export-column-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 8px;
}
.export-column-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 10px;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	background: #fff;
	font-size: 13px;
}
.export-column-item input {
	width: auto;
	margin: 0;
}
.field-section {
	display: block;
	font-size: 13px;
	font-weight: 700;
	color: #1e3a8a;
	margin-top: 14px;
}

.product-form-shell {
	display: grid;
	gap: 14px;
}
.product-modal-head {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding-bottom: 2px;
}
.product-modal-title {
	margin: 0;
	font-size: 22px;
	line-height: 1.25;
	color: #0f172a;
}
.product-section-card {
	border: 1px solid #dbe4f0;
	background: #f8fbff;
	border-radius: 12px;
	padding: 12px;
}
.product-section-card.section-tone-basic {
	background: #eff6ff;
	border-color: #bfdbfe;
}
.product-section-card.section-tone-package {
	background: #f0fdf4;
	border-color: #bbf7d0;
}
.product-section-card.section-tone-supplier {
	background: #fffbeb;
	border-color: #fde68a;
}
.product-section-card.section-tone-outer {
	background: #fff7ed;
	border-color: #fed7aa;
}
.product-section-card.section-tone-media {
	background: #f5f3ff;
	border-color: #ddd6fe;
}
.product-section-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
	padding-bottom: 6px;
	border-bottom: 1px solid #e2e8f0;
}
.product-section-head h4 {
	margin: 0;
	font-size: 14px;
	font-weight: 700;
	color: #0f172a;
}
.product-section-head button {
	width: auto;
	min-width: 90px;
	margin-top: 0;
	padding: 8px 12px;
}
.product-form-grid {
	display: grid;
	gap: 10px;
}
.product-form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.product-form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.product-form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-span-2 { grid-column: span 2; }

.field-inline {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 8px;
	align-items: center;
}
.field-inline button {
	width: auto;
	min-width: 90px;
	margin-top: 8px;
	padding: 9px 12px;
}

.category-picker {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.55);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	z-index: 1200;
}
.category-picker-box {
	width: min(680px, 96vw);
	max-height: 80vh;
	overflow: auto;
	background: #fff;
	border: 1px solid #dbe4f0;
	border-radius: 14px;
	padding: 14px;
}
.picker-tree { max-height: 58vh; }

/* Profile Styles */
.profile-container {
	display: flex;
	flex-direction: column;
	gap: 16px;
	margin-top: 16px;
}
.profile-row {
	display: grid;
	grid-template-columns: 140px 1fr;
	gap: 12px;
	padding: 12px;
	background: #f8f9fa;
	border-radius: 8px;
	border-left: 3px solid #3b82f6;
}
.profile-label {
	font-weight: 600;
	color: #64748b;
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.4px;
}
.profile-value {
	color: #1f2937;
	font-size: 14px;
	word-break: break-word;
}


.picker-item { font-size: 14px; }
.order-picker-box { width: min(980px, 96vw); }
.order-product-picker-box { max-height: 86vh; }
.order-picker-grid {
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	max-height: 62vh;
	overflow: auto;
}
.hidden { display: none !important; }

@media (max-width: 980px) {
	.app-topbar {
		grid-template-columns: 1fr;
		gap: 10px;
		padding: 12px;
	}
	.top-user-card { min-width: 0; }
	.layout { grid-template-columns: 1fr; min-height: auto; }
	.sidebar { position: sticky; top: 68px; z-index: 30; min-height: auto; }
	.product-layout { grid-template-columns: 1fr; }
	.product-form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.product-form-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.field-span-2 { grid-column: span 2; }
	.dash-grid { grid-template-columns: 1fr; }
	.chart-wrap { grid-template-columns: 1fr; }
	.trend-grid { grid-template-columns: repeat(4, 1fr); }
	.auth-wrap-fancy { min-height: auto; margin: 18px auto; padding: 14px; }
	.auth-hero h1 { font-size: 24px; }
	.saved-preview-body { grid-template-columns: 1fr; }
	.saved-preview-image { width: 100%; height: 140px; }
}

@media (max-width: 640px) {
	.global-search-wrap input { font-size: 13px; }
	.modal-box { padding: 12px; }
	.product-section-card { padding: 10px; }
	.product-modal-title { font-size: 19px; }
	.product-form-grid.cols-4,
	.product-form-grid.cols-3,
	.product-form-grid.cols-2,
	.field-inline {
		grid-template-columns: 1fr;
	}
	.field-span-2 { grid-column: span 1; }
	.field-inline button {
		width: 100%;
		margin-top: 0;
	}
}
