/* ============================================
   XIR Finance — Apple/Tencent Cloud Flat Style
   ============================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { position: relative; min-height: 100%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  padding-top: 56px; margin-bottom: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f5f7; color: #1d1d1f; font-size: 14px; line-height: 1.5;
}
a { color: #0071e3; text-decoration: none; transition: color 0.15s; }
a:hover { color: #0077ed; }

/* ---- Navbar: Frosted Glass ---- */
.navbar-default {
  background: rgba(255,255,255,0.72) !important; backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: none !important; border-bottom: 1px solid rgba(0,0,0,0.08) !important;
  box-shadow: 0 0.5px 0 rgba(0,0,0,0.06) !important;
}
.navbar-default .navbar-brand { color: #1d1d1f !important; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.navbar-default .navbar-brand i { color: #FF6D00; }
.navbar-default .navbar-nav > li > a { color: #6e6e73 !important; font-weight: 500; font-size: 14px; transition: color 0.15s; }
.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus { color: #1d1d1f !important; background: transparent !important; }
.navbar-default .navbar-nav > li.active > a,
.navbar-default .navbar-nav > li.active > a:hover,
.navbar-default .navbar-nav > li.active > a:focus { color: #FF6D00 !important; background: transparent !important; font-weight: 600; }
.navbar-default .navbar-toggle .icon-bar { background: #1d1d1f !important; }
.navbar-default .navbar-toggle { border-color: rgba(0,0,0,0.1) !important; }
.navbar-default .navbar-collapse { border-color: rgba(0,0,0,0.06) !important; }

/* ---- Page Content ---- */
.page-content { padding-bottom: 0; }
.container-fluid { max-width: 1800px; }

/* ---- Stat Cards: Clean Flat ---- */
.stat-card {
  background: #fff; border-radius: 12px; padding: 24px 20px; text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04); margin-bottom: 12px;
  border: 1px solid rgba(0,0,0,0.04); transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.stat-card .stat-value { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
.stat-card .stat-label { color: #86868b; font-size: 13px; margin-top: 6px; font-weight: 500; }
.stat-card.income .stat-value { color: #34c759; }
.stat-card.expense .stat-value { color: #ff3b30; }
.stat-card.balance .stat-value { color: #0071e3; }
.stat-card.tenant .stat-value { color: #FF6D00; }

/* ---- Panel: Clean Card ---- */
.panel { border: 1px solid rgba(0,0,0,0.06); border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); overflow: hidden; }
.panel-heading { background: #fff !important; border-bottom: 1px solid rgba(0,0,0,0.06); padding: 14px 20px; font-size: 15px; font-weight: 600; color: #1d1d1f; }
.panel-body { padding: 16px 20px; }
.panel-default > .panel-heading { background: #fff !important; }

/* ---- Table: Grid (WPS-style) ---- */
.table { font-size: 13px; }
.table > thead > th {
  background: #f5f5f7 !important; color: #86868b; font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 8px 10px;
  border: 1px solid #dfe1e5 !important;
}
.table-striped > tbody > tr:nth-of-type(odd) { background: #fafafa; }
.table-striped > tbody > tr:nth-of-type(even) { background: #fff; }
.table-striped > tbody > tr:hover { background: #f0f4ff; }
.table > tbody > td { padding: 6px 10px; vertical-align: middle; border: 1px solid #dfe1e5 !important; line-height: 1.6; }

/* ---- Forms ---- */
.form-control {
  border: 1px solid rgba(0,0,0,0.1); border-radius: 8px; padding: 8px 12px;
  font-size: 14px; transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: none;
}
.form-control:focus { border-color: #0071e3; box-shadow: 0 0 0 3px rgba(0,113,227,0.12); }
.form-control::placeholder { color: #c7c7cc; }

/* ---- Buttons: Flat Rounded ---- */
.btn { border-radius: 8px; font-weight: 500; transition: all 0.15s; border: none; }
.btn-primary { background: #0071e3; color: #fff; }
.btn-primary:hover { background: #0077ed; color: #fff; }
.btn-success { background: #34c759; color: #fff; }
.btn-success:hover { background: #2db84d; color: #fff; }
.btn-danger { background: #ff3b30; color: #fff; }
.btn-danger:hover { background: #e6352b; color: #fff; }
.btn-info { background: #5ac8fa; color: #fff; }
.btn-info:hover { background: #40b8f0; color: #fff; }
.btn-warning { background: #ff9500; color: #fff; }
.btn-warning:hover { background: #e68600; color: #fff; }
.btn-default { background: #e8e8ed; color: #1d1d1f; border: none; }
.btn-default:hover { background: #dcdce1; color: #1d1d1f; }
.btn-xir { background: #FF6D00; color: #fff; }
.btn-xir:hover { background: #e56200; color: #fff; }
.btn-purple { background: #0071e3; color: #fff; }
.btn-purple:hover { background: #0062cc; color: #fff; }

.btn-sm, .btn-xs { border-radius: 6px; }
.btn-lg { border-radius: 10px; padding: 12px 24px; }

/* ---- Alert: Clean ---- */
.alert { border-radius: 10px; border: none; padding: 12px 16px; font-size: 14px; }
.alert-success { background: #e8f9ed; color: #1b7a34; }
.alert-danger { background: #ffe5e3; color: #c62828; }
.alert-warning { background: #fff4e0; color: #b36b00; }
.alert-info { background: #e5f1ff; color: #0055b3; }
.alert-dismissible .close { opacity: 0.4; }

/* ---- Label/Tag: Pill ---- */
.label { border-radius: 6px; font-weight: 500; font-size: 11px; padding: 3px 8px; }
.label-success { background: #e8f9ed; color: #1b7a34; }
.label-danger { background: #ffe5e3; color: #c62828; }
.label-warning { background: #fff4e0; color: #b36b00; }
.label-default { background: #e8e8ed; color: #6e6e73; }

/* ---- Login Page: Centered Apple-style ---- */
body:has(.login-box) { background: #f5f5f7; display: flex; align-items: center; min-height: 100vh; }
.login-box {
  max-width: 380px; margin: 0 auto; padding: 40px; background: #fff;
  border-radius: 16px; box-shadow: 0 2px 20px rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.04);
}
.login-box h2 { text-align: center; color: #1d1d1f; margin-bottom: 32px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.login-box h2 i { color: #FF6D00; }
.login-box .form-control { height: 44px; font-size: 15px; border-radius: 10px; }
.login-box .input-group-addon { background: #f5f5f7; border: 1px solid rgba(0,0,0,0.1); border-right: none; border-radius: 10px 0 0 10px; color: #86868b; }
.login-box .input-group .form-control { border-left: none; border-radius: 0 10px 10px 0; }
.login-box .btn-primary { background: #FF6D00; border: none; width: 100%; height: 44px; font-size: 16px; font-weight: 600; border-radius: 10px; }
.login-box .btn-primary:hover { background: #e56200; }
.login-box .alert { border-radius: 10px; text-align: center; }

/* ---- Install ---- */
.install-box { max-width: 500px; margin: 60px auto; padding: 40px; background: #fff; border-radius: 16px; box-shadow: 0 2px 20px rgba(0,0,0,0.06); }
.install-box h2 { text-align: center; color: #1d1d1f; margin-bottom: 30px; font-weight: 700; }

/* ---- Modal: Rounded ---- */
.modal-content { border-radius: 16px; border: none; box-shadow: 0 8px 40px rgba(0,0,0,0.12); overflow: hidden; }
.modal-header { background: #fff; border-bottom: 1px solid rgba(0,0,0,0.06); padding: 18px 24px; }
.modal-header .close { opacity: 0.3; font-size: 22px; }
.modal-title { font-weight: 700; font-size: 17px; color: #1d1d1f; }
.modal-body { padding: 20px 24px; }
.modal-footer { border-top: 1px solid rgba(0,0,0,0.06); padding: 14px 24px; }

/* ---- Footer ---- */
.footer { position: relative; bottom: auto; left: auto; right: auto; height: auto; line-height: normal; background: transparent; border-top: none; padding: 8px 0; margin-top: 0; }
.footer p { color: #86868b; font-size: 12px; }
.footer a { color: #86868b; }
.footer a:hover { color: #FF6D00; }

/* ---- Inline Edit ---- */
td.editable { cursor: pointer; position: relative; min-width: 40px; }
td.editable:hover { background: rgba(0,113,227,0.04) !important; }
td.editable .cell-text { display: inline-block; min-width: 20px; min-height: 18px; }
td.editable .cell-text.empty { color: #c7c7cc; font-style: normal; }
td.editable input, td.editable select {
  width: 100%; border: 1px solid #0071e3; border-radius: 6px;
  padding: 4px 8px; font-size: 13px; outline: none;
  background: #fff; box-shadow: 0 0 0 3px rgba(0,113,227,0.1);
}
td.editable input[type="datetime-local"] { width: 160px; font-size: 12px; }
td.editable.saving { opacity: 0.5; }
td.editable.saved { background: #e8f9ed !important; }
td.editable.error { background: #ffe5e3 !important; }

/* ---- Rooms Page Specific ---- */
.room-tabs { border-bottom: none; margin-bottom: 0; display: flex; gap: 8px; padding: 8px 0; }
.room-tabs > li { margin-bottom: 0; }
.room-tabs > li > a { color: #86868b; border: 1px solid transparent; border-radius: 20px; padding: 6px 20px; font-weight: 500; font-size: 14px; transition: all 0.2s; background: transparent; }
.room-tabs > li > a:hover { color: #1d1d1f; background: #f5f5f7; border-color: rgba(0,0,0,0.06); }
.room-tabs > li.active > a, .room-tabs > li.active > a:hover { color: #fff; background: #FF6D00; border-color: #FF6D00; font-weight: 600; }

.server-tabs-bar { display: flex; align-items: center; margin-bottom: 0; overflow-x: auto; gap: 6px; padding: 0; }
.server-tabs-bar a.sv-tab {
  display: inline-block; padding: 6px 18px; text-decoration: none; color: #86868b;
  border: 1px solid rgba(0,0,0,0.06); background: #fff;
  border-radius: 20px; font-size: 13px; font-weight: 500; white-space: nowrap; transition: all 0.2s;
}
.server-tabs-bar a.sv-tab:hover { color: #FF6D00; background: #fff8f2; border-color: #FF6D00; }
.server-tabs-bar a.sv-tab.active { color: #fff; font-weight: 600; background: #FF6D00; border-color: #FF6D00; }
.server-tabs-bar a.sv-add { display: inline-block; padding: 6px 14px; color: #86868b; font-size: 16px; text-decoration: none; transition: color 0.15s; }
.server-tabs-bar a.sv-add:hover { color: #FF6D00; }

.room-table { font-size: 13px; table-layout: fixed; width: auto !important; }
.room-table th { white-space: nowrap; background: #f5f5f7 !important; border: 1px solid #dfe1e5 !important; font-size: 12px !important; font-weight: 600; }
.room-table th.th-room { color: #9c27b0 !important; }
.room-table th.th-buyer { color: #FF6D00 !important; }
.room-table th.th-start { color: #f9a825 !important; }
.room-table th.th-end { color: #00bcd4 !important; }
.room-table th.th-srv-expiry { color: #1a237e !important; }
.room-table th.th-domain { color: #0071e3 !important; }
.room-table th.th-port { color: #6e6e73 !important; }
.room-table th.th-backup { color: #795548 !important; }
.room-table th.th-updated { color: #4e342e !important; }
.room-table th.th-days { color: #66bb6a !important; }
.room-table td { vertical-align: middle !important; border: 1px solid #dfe1e5 !important; line-height: 1.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; max-width: 0; }
.room-table tr[style*="height"] td { white-space: normal !important; vertical-align: middle !important; }
.room-table tr[style*="height"] td .cell-text { white-space: normal !important; display: block !important; }
.room-table th { text-align: center; vertical-align: middle; }
.room-table td.editable { cursor: pointer; position: relative; }
.room-table td.editable:hover { background: #f0f4ff !important; }
.room-table td .cell-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; text-align: center; max-width: 100%; }
.room-table td.align-left { text-align: left; }

.room-table tbody tr:nth-of-type(odd) { background: #fafafa; }
.room-table tbody tr:nth-of-type(even) { background: #fff; }
.room-table tbody tr:hover { background: #f0f4ff; }

.room-table td.readonly-port { font-family: "SF Mono", "Fira Code", "Menlo", monospace; font-size: 12px; color: #6e6e73; cursor: default; }
.room-table td.danger-cell { background-color: #ffe5e3 !important; }
.room-table td.days-positive { color: #34c759; font-weight: 600; }
.room-table td.days-expired { color: #ff3b30; font-weight: 600; }
.room-table td.days-positive span, .room-table td.days-expired span { color: inherit !important; }

/* ---- 列宽拖拽手柄 ---- */
.col-resize-handle {
  position: absolute; right: -2px; top: 0; bottom: 0; width: 5px;
  cursor: col-resize; z-index: 2;
}
.col-resize-handle:hover { background: rgba(0,113,227,0.15); }
.room-table th { user-select: none; }


/* ---- 编辑栏（WPS公式栏） ---- */
.formula-bar {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: 12px; flex: 1; min-width: 120px;
}
.formula-bar-label {
  color: #86868b; font-size: 13px; flex-shrink: 0;
}
.formula-bar-input {
  flex: 1; padding: 4px 10px; border: 1px solid #dfe1e5; border-radius: 6px;
  font-size: 13px; outline: none; color: #1d1d1f; background: #fafafa;
  min-width: 1200px;
}
.formula-bar-input:focus { border-color: #0071e3; background: #fff; }

/* ---- 行高列宽输入 ---- */
/* ---- 单元格选中 ---- */
.cell-active { outline: 2px solid #34c759 !important; outline-offset: -2px; }
.cell-editing { outline: 2px solid #0071e3 !important; outline-offset: -2px; }

/* ---- 右键菜单 ---- */
.ctx-menu { animation: ctxIn 0.12s ease; }
@keyframes ctxIn { from { opacity:0; transform:scale(0.95); } to { opacity:1; transform:scale(1); } }
.ctx-item { display:flex; align-items:center; gap:6px; padding:7px 16px; cursor:pointer; transition:background 0.1s; white-space:nowrap; border-radius:4px; margin:0 4px; }
.ctx-item:hover { background:#f0f4ff; }
.ctx-item.ctx-disabled { color:#bbb; cursor:default; }
.ctx-item.ctx-disabled:hover { background:transparent; }
.ctx-icon { font-size:14px; width:20px; text-align:center; flex-shrink:0; }
.ctx-sep { height:1px; background:#e8e8e8; margin:4px 12px; }

.sheet-tabs { background: #fbfbfd; padding: 6px 10px 0; border-bottom: 1px solid rgba(0,0,0,0.06); display: flex; flex-wrap: wrap; gap: 4px; }
.sheet-tabs a { display: inline-block; padding: 6px 14px; border: 1px solid rgba(0,0,0,0.06); border-bottom: none; border-radius: 6px 6px 0 0; background: #fff; color: #86868b; text-decoration: none; font-size: 13px; font-weight: 500; transition: all 0.15s; }
.sheet-tabs a:hover { color: #1d1d1f; background: #f5f5f7; }
.sheet-tabs a.active { color: #FF6D00; font-weight: 600; border-color: rgba(0,0,0,0.08); border-bottom: 1px solid #fff; position: relative; top: 1px; }

.search-box { max-width: 300px; }
.copy-btn { padding: 2px 6px; font-size: 11px; border-radius: 6px; }
.token-cell { text-align: center !important; }
.token-cell > .copy-btn { position: static !important; transform: none !important; float: none !important; margin: 0 !important; }
.room-table td.token-cell > .copy-btn + .token-text { display: none !important; padding-left: 0 !important; }
.room-table td.token-cell > .token-text.empty { display: inline-block !important; }
.room-table td { position: relative; }
.room-table td > .copy-btn { position: absolute; left: 2px; top: 50%; transform: translateY(-50%); z-index: 2; float: none !important; margin: 0 !important; }
.room-table td > .copy-btn + .cell-text { padding-left: 22px; }
.room-table td.saving .copy-btn, .room-table td input ~ .copy-btn { visibility: hidden; }

/* ---- Transaction Page Specific ---- */
.tx-table { background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); overflow: hidden; border: 1px solid #dfe1e5; }
.tx-table table { margin: 0; }
.tx-table thead th { background: #f5f5f7; color: #86868b; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; border: 1px solid #dfe1e5 !important; }
.tx-table tbody td { font-size: 13px; vertical-align: middle; border: 1px solid #dfe1e5 !important; line-height: 1.6; }
.tx-table tbody tr:nth-of-type(odd) { background: #fafafa; }
.tx-table tbody tr:nth-of-type(even) { background: #fff; }
.tx-table tbody tr:hover { background: #f0f4ff; }

.side-card { background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); margin-bottom: 10px; border: 1px solid rgba(0,0,0,0.04); }
.side-card .sc-head { padding: 10px 14px; border-bottom: 1px solid rgba(0,0,0,0.04); font-weight: 600; font-size: 13px; color: #1d1d1f; }
.side-card .sc-body { padding: 10px 14px; font-size: 13px; }

.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 6px; margin: 1px 2px; font-weight: 500; }
.tag-tax { background: #fff4e0; color: #b36b00; }
.tag-charity { background: #e5f1ff; color: #0055b3; }
.tag-refund { background: #ffe5e3; color: #c62828; }
.tag-rental { background: #e8f9ed; color: #1b7a34; }
.tag-purchase { background: #fce4ec; color: #880e4f; }
.tag-transfer { background: #fff8f2; color: #E65100; border: 1px solid rgba(255,149,0,0.2); }

.section-bar { margin: 20px 0 10px; padding-bottom: 8px; border-bottom: 1px solid rgba(0,0,0,0.08); }
.section-bar h4 { margin: 0; font-size: 16px; color: #1d1d1f; font-weight: 700; }

.btn-xir-sm { background: #FF6D00; color: #fff; border-radius: 6px; font-weight: 500; border: none; }
.btn-xir-sm:hover { background: #e56200; color: #fff; }

.modal-xir .modal-header { background: #fff; border-bottom: 1px solid rgba(0,0,0,0.06); }
.modal-xir .modal-title { color: #1d1d1f; font-weight: 700; }

/* ---- Color Utilities ---- */
.text-income { color: #34c759; }
.text-expense { color: #ff3b30; }
.text-refund { color: #ff9500; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c7c7cc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #aeaeb2; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .stat-card .stat-value { font-size: 24px; }
  .stat-card { padding: 16px 12px; }
  .login-box { margin: 20px; padding: 24px; }
}

.cell-selected { outline: 2px solid #34c759 !important; outline-offset: -2px; background: #e8f5e9 !important; }
